String find in a html file for new EA

 

I have developped a code for file interpration with html code , and the second step is to lock the html page in a csv file . 

The EA has to find some strings in the file saved with the csv extension .   The code can not find the string , and the message is

value -1 for the handle for the FileOpen () with this page with the filename .

 

How to get the right string with the page ?

 

Here is the script in the page  :

 

void FindString2Page()

 {

 

// htm file is written, let's parse it now and write to csv file

const string quote = " " ;


int beginning , finalend10 ; 

int handle10P = FileOpen(filename ,FILE_READ|FILE_CSV) ;


string sData = FileReadString(handle10P,0 ) ;

if (sData = - 1 ) return (0) ; 

Print( " Filename      " + filename   ) ;

beginning = StringFind(sData,"<th>Date</th>",0)   ; 

finalend10 = StringFind(sData,"<\form>, 0 ); 


Print("handle10P" + handle10P   ) ;

Print("sData" + sData) ;

Print("beginning" + beginning ) ;

Print("finalend10 " + finalend10 ) ;

Print ( "ok " + "<th>Date</th>")   ; 

Alert( " finalend10 ", finalend10 , "beginning" ,  beginning, "quotes 200 P ", StringSubstr(sData,BG10,  finalend10)); 

 

 

 

 

 }

 

Can someone have some ideas ?

 

How to fix this EA , and make the system work . To get the right files with this . 

 
Maybe they change HTML format are you try find this string manually in HTML file
 

  1. Use "SRC" button to insert code into the post

  2. You should post code that can be compiled.  Line with FileOpen has wrong number of parentheses.

  3. You should check  result of FileOpen() function


 
Drazen Penic:

  1. Use "SRC" button to insert code into the post

  2. You should post code that can be compiled.  Line with FileOpen has wrong number of parentheses.

  3. You should check  result of FileOpen() function

I have tried to modified the EA , and it could work . The problem was the StringFind() function . The correct string was to be set in the settings for the function call .

Now it was sData instead of handle10 . The function did not recognize the string for the web page . Now it works well .  We will try to get more things to do with the web page for this EA . Thank you .

 

Hope all troubles are fixed with this !

Reason: