Well I just found out this as I had trouble to load data from a stream and thought it will be good to tell to the community. Here is the example code using a stream.
SuperStrict
Function SetLR( _L:String , _R:String)
L = _L
R = _R
End Function
Global L:String = "Left"
Global R:String = "Right"
Print "First L = " + L
Print "First R = " + R
'Now I save the Strings in file
Local out:TStream = WriteFile("tmp.txt")
WriteLine out , L
WriteLine out , R
CloseStream out
'now load the stream from the file and use the function to set L and R
Local in:TStream = OpenStream("tmp.txt")
SetLR( ReadLine(in) , ReadLine(in) )
Print "From the Function L = " + L
Print "From the Function R = " + R
'And now load the stream again to set them manual
in = OpenStream("tmp.txt")
L = ReadLine(in)
R = ReadLine(in)
Print "From Manual Set L = " + L
Print "From Manual Set R = " + R
CloseStream(in)
DeleteFile("tmp.txt")
End
|