Hi,
is there a good method how to use the file_sync() member of FATFileSystem.h? I just put file_sync() as a public member of FATFileSystem in my local copy, for testing purposes.
Then I am calling it on my local defined FATFileSystem giving it an input parameter of type FILE* .
SDBlockDevice sd_card_bd;
FATFileSystem sd_card_fs;
int SD_Card_Wrapper::do_some_sync( FILE* filename)
{
fflush(filename);
sd_card_bd.sync();
int err = sd_card_fs.file_sync(filename);
return err;
}
the return of file_sync is -9 (The file/directory object is invalid, see FATFileSystem.cpp).
Am I giving the wrong input type (File* or FileHandle* instead of FILE*)? Is there some description on how the File classes and casting of FileClasses works?
From the following link I got note that FATFileSystem is responsible for synchronizing the file.
https://os.mbed.com/forum/mbed/topic/32521/
My plan is to log data regularily to a SD Card and syncing should help me to prevent dataloss (instead of closing and reopening the file, which would return EOF on my filepointer inbetween).