Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problems with file manipulation... HELP! #305240
01/13/10 18:54
01/13/10 18:54
Joined: Jan 2010
Posts: 4
F
fireapach3 Offline OP
Guest
fireapach3  Offline OP
Guest
F

Joined: Jan 2010
Posts: 4
Hey folks! I have a problem that are kiling my brain! It's really simple, load the contents of the file that i call teste.txt and it's in the same folder of the Script .c ...

Just when i start the aplicattion, this appears:


This is the contents of teste.txt:
Code:
0001: Aqui é o meu lugar pai!
0002: Não me obrigue a fazer isso filho!
0003: NÃO PAI!!!
0004: HAHAHA!!!
// Não é para lêr esta linha!!!
0005: NÃOOO!!!
0006: BOOM!!!
0007: (Silêncio)



Well, i will create a function to locate the strings in the file and use in the subtitles in the game...

But this f*&% error in file_str_read appear on the screen and says the 2° argument is wrong: STRING!

Here is the .c file:
Code:
#include <acknex.h>
#include <default.c>

STRING* Legenda;

var a;
var b;

function main()
{
	a = file_open_game("teste.txt");
	b = file_find(a, "0003:");
	file_str_read(b, Legenda);
	file_close(a);
	draw_text(Legenda, 10, 10, vector(0, 0, 120));
}



I really need this to continue the game! PLZ, help!

Re: Problems with file manipulation... HELP! [Re: fireapach3] #305244
01/13/10 19:08
01/13/10 19:08
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Maybe it is because 'Legenda' is unitialized. Try replacing it with...
STRING* Legenda = " ";


Last edited by DJBMASTER; 01/13/10 19:09.
Re: Problems with file manipulation... HELP! [Re: DJBMASTER] #305261
01/13/10 20:40
01/13/10 20:40
Joined: Jan 2010
Posts: 4
F
fireapach3 Offline OP
Guest
fireapach3  Offline OP
Guest
F

Joined: Jan 2010
Posts: 4
Well... now the error do not appear, but the 3DGS CRASHES e shutdown! XD

Any problem with the function that i used?

Last edited by fireapach3; 01/14/10 07:58.
Re: Problems with file manipulation... HELP! [Re: fireapach3] #305466
01/14/10 21:35
01/14/10 21:35
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline
Serious User
Lion_Ts  Offline
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
i think, it was a good idea to initialize the string. but, seems, you're demaging the memory reading into the empty string laugh
allocate string with enough space to hold the data (like: STRING* line="#4000";)


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1