Problem with file read

 

Hi all,

can u please help me with my problem?

I read all lines from csv file to array.

Problem is that when i read the last line all array lines change with this line.

void ReadFile()
 {
  int cmd = 0;
  string str = "";
  int handle=FileOpen("TradeCopy.csv",FILE_READ|FILE_CSV);
  if (handle>0)
   {
    while(FileIsEnding(handle)==false)
     {
      str = FileReadString(handle);
      if (str!="") 
       {
        lines[cmd] = str;
        cmd ++;
       }
     }
   FileClose(handle);
  }
  else 
   Print("Chyba pri otvarani : ",GetLastError());
}

Can somebody please help me with this problem?

Thank a lot.

 
How big is lines[]. You're not testing for max length.
 

Hi friends,

i forgot used ArrayResize()...:(

Thanks for posts

Reason: