
28 Mar
2010
28 Mar
'10
7:53 a.m.
Hi all, I'm trying to work out how to chop some data off the end of a file once I have finished modifying it. I'm not sure how to adjust the file size in a portable fashion, and although I'm using boost::iostreams I can't see how to either set the size of the underlying stream or how to otherwise indicate where the stream should end. Is this possible with boost:iostreams? If not, is there another portable way to remove data from the end of a file, causing its size to shrink? All I can find around the place are calls to ftruncate() and the like, but I would like my program to work on Windows as well as Linux, and hopefully other platforms too. Many thanks, Adam.