quick help

BlitzMax Forums/BlitzMax Beginners Area/quick help

GamerTheHut(Posted 2006) [#1]
this line give me an error;

file = ReadFile(FileQueue[ActiveQueue,1])

Unable to conver from 'TStream' to 'String'

Can anyone clue me in? as a matter of fact if i run the source from my laptop it works fine! and the code is exactly the same. I even updated from my older version of Blitz Max that was 1.09


SculptureOfSoul(Posted 2006) [#2]
the variable named "file" needs to be of type TStream, since that's what is returned by ReadFile.


GamerTheHut(Posted 2006) [#3]
can i get the returned tstream to become a regular string? or how do i make 'file' a tstream?


SculptureOfSoul(Posted 2006) [#4]
ReadFile is not actually reading data from a file, but is instead opening a file for input, that's why it's returning a stream. You then read from the stream itself, via the stream functions such as "ReadByte", "ReadLine" etc...(check out Modules->Stream in the doc's for all of the functions).

So, you'd go:
global file:TStream
file = ReadFile("the file you want to open here")
print( readline(file))

Readline returns a single (newline or null terminated) string from the specified stream.


GamerTheHut(Posted 2006) [#5]
AWESOME! it now works. Thanks, i don't know why it worked for so long before without the ":tstream" but oh well.