Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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 | 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