Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 715 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Read data web #474526
10/21/18 16:59
10/21/18 16:59
Joined: Apr 2018
Posts: 37
S
sdelatorre Offline OP
Newbie
sdelatorre  Offline OP
Newbie
S

Joined: Apr 2018
Posts: 37
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

Re: Read data web [Re: sdelatorre] #474544
10/22/18 14:01
10/22/18 14:01
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
The lines look unsuspicious. Can you post the complete script in a version that crashes?

Re: Read data web [Re: jcl] #474713
10/31/18 15:12
10/31/18 15:12
Joined: Apr 2018
Posts: 37
S
sdelatorre Offline OP
Newbie
sdelatorre  Offline OP
Newbie
S

Joined: Apr 2018
Posts: 37
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

Re: Read data web [Re: sdelatorre] #474717
10/31/18 17:44
10/31/18 17:44
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Copying a large website into an empty string is no good idea.

Re: Read data web [Re: jcl] #474718
10/31/18 21:35
10/31/18 21:35
Joined: Apr 2018
Posts: 37
S
sdelatorre Offline OP
Newbie
sdelatorre  Offline OP
Newbie
S

Joined: Apr 2018
Posts: 37


OK, but how I can do it easily?

Re: Read data web [Re: sdelatorre] #474719
10/31/18 22:58
10/31/18 22:58
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago

Re: Read data web [Re: AndrewAMD] #474869
11/10/18 07:54
11/10/18 07:54
Joined: Apr 2018
Posts: 37
S
sdelatorre Offline OP
Newbie
sdelatorre  Offline OP
Newbie
S

Joined: Apr 2018
Posts: 37
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

Re: Read data web [Re: sdelatorre] #474871
11/10/18 08:04
11/10/18 08:04
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
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.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1