mql4 question

 

hello, i have a problem in the code .

for (int Path_Counter = 0 ; ; Path_Counter ++)
{
FileSeek(File_Id,End_Line_Char+1,SEEK_SET);
string File_Str=FileReadString(File_Id,1000000);
int End_Of_Line=StringFind(File_Str,"\n",0);
End_Line_Char+=End_Of_Line+1;
ArrayResize(Client_Paths,Path_Counter+1);
Client_Paths[Path_Counter]=StringSubstr(File_Str,0,End_Of_Line);
if(Client_Paths[Path_Counter]=="")
{
break;
}

}

when i print it like that :

Alert(Client_Paths[Client_Path_Counter]+"\\"+File_Name+" "+Files_Counter+".txt");

is give me only Client_Paths[Client_Path_Counter] string.

but if i print it like that :

Client_Paths[Client_Path_Counter]="C:\\Program Files\\InstaTrader\\experts\\files";

Alert(Client_Paths[Client_Path_Counter]+"\\"+File_Name+" "+Files_Counter+".txt");

is give me the correct string .

so how i can to reslove this problem ?

 
anri97:

hello, i have a problem in the code .

<CODE REMOVED>

when i print it like that :

Alert(Client_Paths[Client_Path_Counter]+"\\"+File_Name+" "+Files_Counter+".txt");

is give me only Client_Paths[Client_Path_Counter] string.

but if i print it like that :

Client_Paths[Client_Path_Counter]="C:\\Program Files\\InstaTrader\\experts\\files";

Alert(Client_Paths[Client_Path_Counter]+"\\"+File_Name+" "+Files_Counter+".txt");

is give me the correct string .

so how i can to reslove this problem ?

Please read some other posts before posting . . .

Please edit your post or have your thread removed . . . please use the SRC button to post code: How to use the SRC button.

 
  1. SRC
  2. string File_Str=FileReadString(File_Id,1000000);
    int End_Of_Line=StringFind(File_Str,"\n",0);
    If you open the file as text, you will not see the newline. Just read the lines.
       int      handleOPT   = FileOpen(nameOPT, FILE_CSV|FILE_READ, '~');
       if(handleOPT < 1){ ... // No such file.
       for (int Path_Counter = 0 ; ; Path_Counter ++){
          string   line = FileReadString(handleOPT);
          if(      line == "") ... // EOF.
          ArrayResize(Client_Paths,Path_Counter+1);
          Client_Paths[Path_Counter]=line;
    

  3. Alert(Client_Paths[Client_Path_Counter]+"\\"+File_Name+" "+Files_Counter+".txt");
    is give me only Client_Paths[Client_Path_Counter] string.
    When you exit the loop, the array has Path_Counter strings Array element [0] through element [Path_Counter-1] There is no array element [Path_Counter]. There is no variable Client_Path_Counter or Files_Counter in your posted code.

  4. Client_Paths[Client_Path_Counter]="C:\\Program Files\\InstaTrader\\experts\\files";
    Don't install in \program files* avoid the UAC problems.