I am using this code for getting information from a website that I scrape for news and getting these two error messages on the expert log
- 806912 bytes of leaked memory
- 1 leaked strings left
When I ran get the last error message, I get ERR_INVALID_ARRAY
here is the function that I suspect is causing the error, I am suspecting that it has something to do with these two arrays post[], result[] though I am not sure. Any form of help will be appreciated
string ReadCBOE()
{
string cookie=NULL,headers;
char post[], result[];
string TXT="";
int res;
string str;
static string str2 = "";
string google_url="http://ec.forexprostools.com/?columns=exc_currency,exc_importance&importance=1,2,3&calType=week&timeZone=15&lang=1";
ResetLastError();
int timeout=5000;
res=WebRequest("GET",google_url,cookie,NULL,timeout,post,0,result,headers);
if(res==-1)
{
Print("WebRequest error, err.code =",GetLastError());
MessageBox("You must add the address 'http://ec.forexprostools.com/' in the list of allowed URL tab 'Advisors' "," Error ",MB_ICONINFORMATION);
}
else
{
int filehandle=FileOpen("news-log.html",FILE_WRITE|FILE_BIN|FILE_ANSI);
if(filehandle!=INVALID_HANDLE)
{
FileWriteArray(filehandle,result,0,ArraySize(result));
FileClose(filehandle);
//------+
int file_handle=FileOpen("news-log.html",FILE_READ|FILE_BIN|FILE_ANSI);
if(file_handle!=INVALID_HANDLE)
{
do
{
ResetLastError();
string Largestr=FileReadString(file_handle,4000);
if(GetLastError()!=0) break;
StringConcatenate(str,str,Largestr);
}
while(GetLastError()==0 && !FileIsEnding(file_handle));
FileClose(file_handle);
}
else PrintFormat("Failed to open %s file, Error code = %d","news-log.html",GetLastError());
}
}
return(str);
}