How to truncate a file?

Hi, 

I'm writing CVS formatted data to a log file. When the system loses power unexpectedly and the write operation is interrupted it can happen that the last line of the file is incomplete (fewer columns). To tidy up the file I want to remove the last line. Currently the only option to do this seems to copy the entire file, which is quiet inefficient (files can have 100MB to 1GB). On a unix system one could use the ftruncate function to remove the tail of the file. Is there a similar (efficient) option for the Keil filesystem? 

Best,

Valentin

0