1
Discussion - Software / Trouble appending data to an existing file
« on: August 11, 2018, 05:48:39 PM »
Hello,
I am trying to append data or text to an existing file. I am able to open the existing file but I always write over the existing data instead of appending new data to the existing data. See my code below. Do I need to use a function like "f_lseek" to change the writing position of the file? Any help would be appreciated.
Here is how I open the file:
res = f_open(&f, EXAMPLE_FILE, FA_WRITE | FA__WRITTEN | FA_OPEN_EXISTING/*| FA_CREATE_NEW*/);
Here is the function used to write data:
f_write(&f, data, towrite, &written);
I am trying to append data or text to an existing file. I am able to open the existing file but I always write over the existing data instead of appending new data to the existing data. See my code below. Do I need to use a function like "f_lseek" to change the writing position of the file? Any help would be appreciated.
Here is how I open the file:
res = f_open(&f, EXAMPLE_FILE, FA_WRITE | FA__WRITTEN | FA_OPEN_EXISTING/*| FA_CREATE_NEW*/);
Here is the function used to write data:
f_write(&f, data, towrite, &written);