Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 747 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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