This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to truncate a file ?

We are using Keil 5.22 and RTL library on a LPC1768 board on which we have an SD card interface.

All the usual file access works, fopen(), fprintf(), fdelete(), frename() etc...

However I can't find anything like ftruncate() or chsize().

I want to be able to reduce the size of a file to remove fixed length data records from the end of it.

Is there a way to do this with the Keil Library ?

I could do it by reading the file into new file and then deleting and renaming but this would be very in-efficient.