
18 Dec
2010
18 Dec
'10
12:12 a.m.
Is there some way to downsize a file? More specifically, if I open a filebuff: f( "foo.txt",std::ios_base::in|std::ios_base::out|std::ios_base::trunc|std::ios_base::binary); then space forward, write a character, f.pubseekoff( 10000, std::ios_base::beg); write a character, f.sputc(0); f.pubsync(); Is there someway for me to "unwrite the character", and reduce the file size? I am in a situation where I am allocating big files for mmap's, and then when I am done, I have a lot of unused space which I would like to release.