How to use FATFS in P1 to read a line?

I am using the FATFS library in flashee-eeprom on P1. From this example, I was able to create a FATFS of 1 MB size, create a file, write to a file, read from the file and finally delete the file.

I have questions about the read API which is,
char buf[128];
((fr=f_read(&fil, buf, sizeof(buf), &dw))==FR_OK);

From what I understood, this API reads the data from the file pointer fil and writes the data to buf array. But I want to read line by line based on the terminating character. How do I do this?

EDIT(More questions):

  1. How do I append data to the existing file? This API,

         ((fr=f_write(&fil, message, strlen(message)+1, &dw))==FR_OK);

writes the message buffer to the fil object. How do I add more data to the same file object? I want to invoke this f_write in a loop so that the data gets added to the same file.


@mdma Any ideas?

@tylercpeacock are you able to help out here?