EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SolFSStream.Seek can cause file truncation

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
Posted: 05/05/2014 17:03:37
by Jeremy Spiegel (Standard support level)
Joined: 01/29/2014
Posts: 16

I found that if I seek beyond the end of a file and then seek back to the beginning, the file is truncated to zero bytes. The following code demonstrates the problem:
        SolFSStorage storage;
        SolFSStream stream(&storage, "/file", "w");
        stream.Write("a", 1);
        stream.Seek(2, 0);
        stream.Seek(0, 0);
SolFSStorage storage;
std::cout << SolFSStream(&storage, "/file", "r").get_Length() << std::endl;

The code above prints out "0", but if I remove either or both of the Seeks, it prints out "1".

Posted: 05/06/2014 01:33:18
by Eugene Mayevski (EldoS Corp.)

Moved to Helpdesk.

Sincerely yours
Eugene Mayevski



Topic viewed 1970 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!