Read and write data from a specified point in text file

In e2studio (Synergy project), when I read a .txt file from emmc I put all the data in a structure in RAM and when I write, I copy all the data of the structure in the file. So the .txt file and the structure contains the same quantity of data.

What I need to do now is use a bigger .txt file (so the data in the file are more than the data that the structure contains), from which I want to read only a part of it and put the data in the same structure I already use. 

I should read the data in the file from a specified position (an offset) instead of from the beginning. Is it possible?

In the same way, I need to write the data of the structure in a specified position in the file instead of from the beginning.

 

These are the functions that I am using now:

char nameFile_ReportCycle[] = "Report_cycle.txt";
FX_FILE g_file_report_cycle;
struct TypeReportCycle ReportCycle[NUM_CYCLE];

 

#define fx_file_read _fxe_file_read
#define fx_file_write _fxe_file_write


fx_file_read(&g_file_list_cycle, &ListCycle, sizeof(struct TypeListCycle)*(NUM_CYCLE), &tmp);
fx_file_write(&g_file_report_cycle, &ReportCycle, sizeof(struct TypeReportCycle) * NUM_CYCLE);

 

Thank you

Parents Reply Children
No Data