eclipse-threadx/filex

About multiple writes to files

weycen opened this issue · 2 comments

Say this in the description of fx_file_open(): "A file may be opened for reading multiple times, while a file can only be opened for writing once until the writer closes the file", how to understand this sentence? Does it mean that the operation process of the file below is wrong?

status = fx_file_open(&sdio_disk, &fx_file, PATH, FX_OPEN_FOR_WRITE);
if (status != FX_SUCCESS) {
// do something
}

while(1) {
update_data(buffer); // update the data of buffer

status = fx_file_write(&fx_file, buffer, sizeof(buffer));
if (status != FX_SUCCESS) {
// do something
}

delay_ms(500); // delay 500ms
}

And if the fault-tolerant module is enabled, can it be opened once and write multiple times?

Once the file is opened in write mode, multiple write's can be performed

I got it, thanks.