How to read last line in .csv file?

 
I'm having problems with this task. I need to read the last line of a .csv file actually the first comma separated string in the last line.

I have Date,Time,High,Low,Close,Volume and I want the date. Everything I try does not work. I have this. Can anyone help?

tia

         
         fileOut = FileOpen(File2Write, FILE_CSV|FILE_READ|FILE_WRITE, ",");
         // We must get the last date of data written to the file 
         while(!FileIsEnding( fileOut ))
         {
            str1 = FileReadString(fileOut);
            cnt++;
         }
         // Now get the number of sets of data needed from last set to current set
         
         Alert("Last date written: " + str1);
 
keep previous line ending position. when You reach file ending set file position to previous saved position
 
a do{..}while(..) would also be effective (wouldn't it?)

I guess there is no do-while in MQL4.
 
do...while was not implemented
as a rule used while(!feof(some_file))
    while(!FileIsEnding(handle))
      {
       if(FileIsLineEnding(handle)) start_line=FileTell(handle);
      }
 
The only time that FileIsEnding(handle) returns true is when the file is closed.
FileSeek(handle,5,SEEK_END);
bEnd1=FileIsEnding(handle); // bEnd1=0
FileSeek(handle,0,SEEK_END);
bEnd2=FileIsEnding(handle); // bEnd2=0
FileClose(handle);
bEnd3=FileIsEnding(handle); // bEnd3=1

Pre Build 184 FileIsEnding() worked.

In the interim determine the FileSize and then append a dummy line of known length so as to extract the last line
of data.
Reason: