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
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 | 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