Thanks for all the replies.
What are you trying to accomplish with the truncation? Maybe there is another way to solve the problem without requiring the file to actually be truncated?
I've written a lightweight database engine which creates tables, inserts/updates/deletes records and searches the table. The idea is that if records at the end get deleted, the file size gets smaller.
I have come up with a solution to this problem based on your suggestions. It now doesnt resize the file but will attempt to recycle previously deleted records when a record is created. I also added a compact function which when called, it re creates the table and copies all the data over and removes any un used space.
And again, a big thanks to both of you for your replies. Your help was very useful.
Is there a function inside the mbed library to truncate files? Normally, its called ftruncate but the compiler cannot find that.
Thanks in advance.