Page 1 of 1

Grabbing Numeric Strings to use as data

Posted: Sun Jul 20, 2003 3:08 am
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....

Re: Grabbing Numeric Strings to use as data

Posted: Sun Jul 20, 2003 4:49 am
by ricardo
I think that you can do it in this way:

Height = Val(ReadString())
Width = Val(RaedString())

Eureeka!

Posted: Sun Jul 20, 2003 5:12 am
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