incbin problem

BlitzMax Forums/BlitzMax Programming/incbin problem

hub(Posted 2007) [#1]
Hi !
It seems to be not possible to use an incbin file with openfile ? it seems not work here :

note 'end.txt' is an classic text file edited with notepad.

Incbin "media/end.txt"
Local f:TStream
f = OpenFile ("incbin::media/end.txt")
If f = Null Then RuntimeError ("not work !")


Could you correct me !
Thanks !


Brucey(Posted 2007) [#2]
LoadText() should work.

Note, you'll also have to import RamStream if you are using Framework...


hub(Posted 2007) [#3]
Thanks Brucey for this command, but with it how to extract the data (to read line by line the file) ? Is it a stream ? Is there an example somewhere (nothing into the bmax documentation) ?

from my previous code :
While Not Eof(f)
t$ = ReadLine (f)
Wend



hub(Posted 2007) [#4]
ok i've just updated my code to parse/read a return string. Thanks for your help Brucey !


GfK(Posted 2007) [#5]
ReadFile should work. OpenFile may not because it permits both reading and writing. I'm quite sure you won't be able to write to Incbin files.


hub(Posted 2007) [#6]
"ReadFile should work"
This is true. Thanks Gfk.