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)
Asked
Active
Viewed 423 times
0
-
1How about `f_truncate`? It is clearly listed in the API. Did you read it? – Paul Ogilvie Jun 15 '20 at 09:55
1 Answers
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);

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

Florian Moser
- 111
- 6