0

I'm using Chan's FatFS (http://elm-chan.org/fsw/ff/00index_e.html) in C and I'm trying to delete all the following lines from a specific point of a file. I've set the filepointer to my new "End of file", the rest of the file should be deleted/discarded/what ever. I'm searching for a way around a temporary file. Is there a solution like putting a '\0' at the new end of a C-String? (I know that EOF isn't a character anymore)

1 Answers1

2

I've found the answer by myself, but I will still answer my own question to avoid other people getting into my situation.

There's a function in Chan's FatFS to truncate the file:

FRESULT f_truncate(FIL* fp);

http://elm-chan.org/fsw/ff/doc/truncate.html

Paul Ogilvie
  • 25,048
  • 4
  • 23
  • 41