Bankstream - Readline

BlitzMax Forums/BlitzMax Beginners Area/Bankstream - Readline

Volker(Posted 2008) [#1]
Whats wrong with this code?
"t" is empty after ReadLine.

SuperStrict
Local mbank:TBank = CreateBank()
Local mbstream:TBankStream = CreateBankStream (mbank)
Local t:String = "Line"

mbstream.WriteLine (t)
t = mbstream.ReadLine()
Print t


grable(Posted 2008) [#2]
The position of the stream is altered after the write, so there is no data to read.
Try seeking to the beginning before reading.
Local mbank:TBank = CreateBank()
Local mbstream:TBankStream = CreateBankStream (mbank)
Local t:String = "Line"
mbstream.WriteLine (t)
mbstream.Seek(0) ' <------
t = mbstream.ReadLine()
Print t 



Volker(Posted 2008) [#3]
Checked. Thanks!