I am trying to read the last line time value from a csv file. Check the following:
2018-07-26 11:04:00 1.17272 1.17275 1.17267 1.17272
2018-07-26 11:05:00 1.17272 1.17273 1.17265 1.17268
2018-07-26 11:06:00 1.17268 1.17273 1.17261 1.17264
The above is sample data. I have tried the following code and the result is as follows:
int file = FileOpen("latest.csv",FILE_READ|FILE_SHARE_READ|FILE_CSV|FILE_COMMON);
if(file != INVALID_HANDLE)
{
FileSeek(file,-100,SEEK_END);
while(!FileIsLineEnding(file))
{
Print(FileReadString(file));
}
}
FileClose(file);
Output:
8-07-26 11:06:00
1.17268
1.17273
1.17261
1.17264
I m not getting the complete date value. Even if I try to increase the offset of the FileSeek()
function.
Kindly, let me know how is it possible to read the csv file's last line.