..string to integer/float..

BlitzMax Forums/BlitzMax Programming/..string to integer/float..

Naughty Alien(Posted 2009) [#1]
..hi guys..just quickie one..how should i convert my integer/floats loaded as a string in to numeric variable..


Gabriel(Posted 2009) [#2]
With the String.ToInt() and String.ToFloat() methods?


Digital Anime(Posted 2009) [#3]
Like this :

Global filename:String = "test.txt"
Global file:TStream
Global number1:Int
Global number2:Int

file = WriteFile(filename)

WriteLine file,"4"
WriteLine file,"6"

CloseFile(file)

file = ReadFile(filename)

number1 = Int(ReadLine(file))
number2 = Int(ReadLine(file))

Print number1 + number2

CloseFile(file)



Naughty Alien(Posted 2009) [#4]
..thanks guys...