EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SolFSStream.Seek can cause file truncation

Posted: 05/05/2014 17:03:37
by Jeremy Spiegel (Standard support level)
Joined: 01/29/2014
Posts: 30

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 (Team)

Moved to Helpdesk.

Sincerely yours
Eugene Mayevski



Topic viewed 4210 times

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


Back to top

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

Got it!