Grabbing Numeric Strings to use as data

Advanced game related topics
kcraft
User
User
Posts: 18
Joined: Sun Jul 13, 2003 7:29 am
Contact:

Grabbing Numeric Strings to use as data

Post by kcraft »

I am trying to read a string of numbers from a file, to use as numeric variables, I can't use ReadString() and ReadWord(), ReadLong(), ReadFloat() etc, all return extremely high values. See code below

Code: Select all


if FileSize("screensettings.txt") = -1
  width=800
  height=600
else
  ReadFile(0, "screensettings.txt")
  FileSeek(1)
  width=ReadWord()
  FileSeek(2)
  height=ReadWord()
Endif

The file has 2 lines they are :

Code: Select all

800
600
thats it. when I get this right, there will be more settings in the file, this is just so the program can save the settings later on.

thanks for any help....
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Grabbing Numeric Strings to use as data

Post by ricardo »

I think that you can do it in this way:

Height = Val(ReadString())
Width = Val(RaedString())
ARGENTINA WORLD CHAMPION
kcraft
User
User
Posts: 18
Joined: Sun Jul 13, 2003 7:29 am
Contact:

Eureeka!

Post by kcraft »

Thank you. I couldn't figure that out. Now that that is finished, my menu system will be finished soon. :-D thanks again
Post Reply