Question about "file_str_read"

Posted By: Des_Tiny

Question about "file_str_read" - 04/05/06 13:50

Hi,

I want to read out of a *.txt file. The manual tells, that I have to give a handle and a string:
file_str_read (handle, string)
My Code:
string save_nr;
var_nsave fhandle_save;
...
fhandle_save = file_open_read("save.txt");
file_str_read(fhandle_save, save_nr);

The "save.txt" file is simply 1 character: "1"
When I start the game, I get an error: "Read-only save_nr"
Can I use a variable and not a string?

Animorphs
Posted By: vlau

Re: Question about "file_str_read" - 04/05/06 15:56

I don't have any error with your codes running
both in 6.31.4 and 6.40.2

What is your GS version?
Did the save.txt located in the same directory
of your program.
Posted By: Des_Tiny

Re: Question about "file_str_read" - 04/05/06 16:09

i changed the code, now it should work, but I have an other prob:
If I write
while("a" != "a"){...}
then it goes into the loop.
Or if I write
if("a" == "a"){...}
then it does not go into the loop...

the txt file is in the SAVEDIR.
I have the 6.10.2 version, but the one from Sybex
Posted By: Des_Tiny

Re: Question about "file_str_read" - 04/05/06 16:21

[censored], I've found "str_cmp()". Last time i used GS was 4 months ago.
Posted By: vlau

Re: Question about "file_str_read" - 04/05/06 16:26

You need str_cmp or str_cmpi to compare two strings
or characters instead of what you did.

I think 6.10.2 is too old, update your GS version
if you can.
Posted By: Des_Tiny

Re: Question about "file_str_read" - 04/05/06 17:43

I think I cant update, cause I have the Sybex version.
© 2024 lite-C Forums