I wish to write a line of text to the start of a new file so I need to check to see if the file exists and if not, create it and write the line. If the file exists, it should already have the line so I just need to append data.
I wonder if it is legal to Assign, get the filesize and then append as in the following example.
Code: Select all
Mmc_Fat_Reset(filesize); //Get the size of the file
if (filesize==0) Mmc_Fat_Write(Product, 32); //If the filesize is zero, the file has just been created
Mmc_Fat_Append();
Mmc_Fat_Set_File_Date(Bcd2Dec(year)+2000,Bcd2Dec(month),Bcd2Dec(date),Bcd2Dec(hours),Bcd2Dec(minutes),0);
Mmc_Fat_Write(Data, i); // write data to the assigned file
Code: Select all