//+------------------------------------------------------------------+ //| Win32API_read_02.mq4 | //| amenbo | //| type2 | //+------------------------------------------------------------------+ #property copyright "amenbo" // #import "kernel32.dll" int _lopen (string path, int of); int _lcreat (string path, int attrib); int _llseek (int handle, int offset, int origin); int _lread (int handle, string buffer, int bytes); int _lwrite (int handle, string buffer, int bytes); int _lclose (int handle); #import //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { //---- string path="C:\\myLog\\API.txt"; string buffer="";//type2 string add="K";//type2 Print("Before: buffer= ",buffer); //int count=30; int count=0;//type2 int result_o; int handle_o=_lopen (path,0);//read_mode // // if(handle_o<0) { Print("Error openig file",path); return(0); } // result_o=_llseek (handle_o,0,0);//set cursor top of file // if (result_o<0) { Print("Error placing cursor",path); return(0); } // //--------- int result_o2=_llseek(handle_o,0,0); //-------- // if(result_o2<0) { Print("Error placing cursor"); return(0); } // //-------- //int result_o3=_lread(handle_o,buffer,count); int result_o3=_lread(handle_o,add,1); while(result_o3>0) { buffer=buffer+add; add="A"; result_o3=_lread(handle_o,add,1); } //-------- // /* if(result_o3<0) { Print("Error reading from file ",path," ",count," bytes"); return(0); } // */ int result_o4=_lclose(handle_o); // if(result_o4<0) { Print("Error closing file ",path); return(0); } //---- Print("After: buffer= ",buffer); // PlaySound("alert2.wav"); // //------- return(0); }