Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 1,395 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Reading strings via a file #165876
11/05/07 05:56
11/05/07 05:56
Joined: Mar 2005
Posts: 84
The Sacred Silence and Sleep
Spectre Offline OP
Junior Member
Spectre  Offline OP
Junior Member

Joined: Mar 2005
Posts: 84
The Sacred Silence and Sleep
Sorry, this stuff appears to be beyond my skill

From the manual:
Code:
STRING sTest;
...
fhandle = file_open_read("test.txt"); // test.txt contains "this,is,a,test"
file_str_read(fhandle,sTest); // sTest now contains "this"
file_close(fhandle);



But that doesn't explain to me how I get sTest to contain "test" or "is"? If "test.txt" actually contained 100 strings, how can I more or less randomly assign one of those strings to sTest?

If I can get an answer to this I think I can go ahead and begin my new project, so any help in sorting this would be immensely appreciated.

Re: Reading strings via a file [Re: Spectre] #165877
11/05/07 09:57
11/05/07 09:57
Joined: Jul 2003
Posts: 85
France
Gandalf Offline
Junior Member
Gandalf  Offline
Junior Member

Joined: Jul 2003
Posts: 85
France
You can use this:
Code:
v_data = 0;// randomly this variable in a fonction and call read_help
v_loop_help =0;
var filehelp;

function read_help ()
{
filehelp = file_open_read (filehelp_str);// open file
while (v_loop_help < v_data)
{
file_str_read (filehelp, help1_str);
v_loop_help = v_loop_help + 1;
}
file_close (filehelp);
v_loop_help =0;
v_data = 0;
return;
}



in the text file I wrote words or sentence the one underneath other one
first line: I like 3DGS
seconde line: oups!
third line: 3DGS rules
if v_data =1 help1_str= I like 3DGS
if v_data =2 help1_str= oups!
if v_data =3 help1_str= 3DGS rules
etc....


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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