I'm looking for a safe and cross-platform way to truncate a file to a specified size > 0 (lesser length when file's current length). It was very easy in Delphi:
Seek(f,position);
Truncate(f);
I'm surprised there is no method for this in wxFile
class.
Using temporary file to copy contents is not acceptable.
There is indeed no such method, you need to call ftruncate(f.fd())
yourself under Unix or SetEndOfFile()
under Windows.