Posted By: sdelatorre
Read data web - 10/21/18 16:59
Hello,
I'm using :
file_append("cot.txt",
http_transfer("http://www.zorro-trader.com/",0),1024);
contentWeb=file_content ("cot.txt");
printf("Webpage %s",contentWeb);
and I Works perfectly but there is a problema because the size of web is bigger than 1024 and when I get the web completely ( without 1024) the file is correct but the Zorro crash.....
Any idea ?
Thanks in advance
Posted By: jcl
Re: Read data web - 10/22/18 14:01
The lines look unsuspicious. Can you post the complete script in a version that crashes?
Posted By: sdelatorre
Re: Read data web - 10/31/18 15:12
This is the complete code:
string contentWeb;
string copy="";
function main(){
file_delete("cot.txt"); // delete previous report
file_append("cot.txt",
http_transfer("https://www.zorro.com",0),0);
contentWeb=file_content ("cot.txt");
strcpy(copy,contentWeb);
printf("Content es %s",copy);
printf("nfinished");
}
it crash...........if I change http_transfer("https://www.zorro.com",0),0);
by
http_transfer("https://www.zorro.com",0),1024); -> There is not problem
Posted By: jcl
Re: Read data web - 10/31/18 17:44
Copying a large website into an empty string is no good idea.
Posted By: sdelatorre
Re: Read data web - 10/31/18 21:35
OK, but how I can do it easily?
Posted By: AndrewAMD
Re: Read data web - 10/31/18 22:58
Posted By: sdelatorre
Re: Read data web - 11/10/18 07:54
Hello,
I'm copyng into a string in my code, the problem is Zorro crash and it can't read more tan 1024 bytes
Sorry,, but I don't watch the solution
Posted By: jcl
Re: Read data web - 11/10/18 08:04
Of course it crashes. You need a string of sufficient length for copying a website. Define it either as a static char array, or allocate it with mem_alloc. Look into the links by AndrewAMD. And also consider looking in a C book: when you begin to work with arrays and allocations, it's a bit beyond the simple C from the workshops in the manual.