Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 559 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 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,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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

Chief Engineer
jcl  Offline

Chief Engineer

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

Chief Engineer
jcl  Offline

Chief Engineer

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