hi, have a short question: does anybody know why the fseek command works in files (EFS) which are opened in write-mode in mostly all cases? but not at jump to the end of the file. as described it should not be supported in all cases, only if a file is opened in read-mode regards heiko
Hello Heiko,
According to two places in online documentation, using fseek() on a file opened in write mode in the embedded file system is not supported: www.keil.com/.../group__stdio__routines.html This is also mentioned in EFS' main page in the Limitations section.
I guess this is one of the many advantages of the middleware's FAT file system, where you can do fseek() in write mode.
As a workaround, you may try calling fseek() then fgetpos() while in read mode. Close the file. Then open file in write mode, and use fsetpos() to get back to the same file position you want to go. You could store multiple file positions with multiple calls to fseek() and fgetpos(). But the workaround, especially extra fclose() and fopen() increases execution time.
Also, bear in mind, file fragmentation may become an issue after many small writes, in different places.
Thanks, Zack
hey zack, thanks for your reply. i think i´ll prefer the usage of the middleware FAT FS instead of RAMDisk. thought to use it because of execution time but at the end i had to store it in a FAT file again. so parsing one file and store it in another file with new parts will be faster as the other solution. thanks again heiko