Trying to experiment with file I/O but...

Monkey Forums/Monkey Programming/Trying to experiment with file I/O but...

Steve Ancell(Posted 2013) [#1]
All I ever get is an error box that states "Identifier 'FileStream' not found."





Markus(Posted 2013) [#2]
maybe u use target html5 ?

HOME / API REFERENCE
brl.filestream The FileStream class for reading and writing files Android, iOS, Win8, Glfw, Stdcpp


Midimaster(Posted 2013) [#3]
1.
Try to use an ending like ".txt" and test it again....

2.
For a first test, add a file manually and then test only reading.

3.
Read the manual about permitted pathes. I guess your app tries to use the "myapp.data" dir, which is read only

4.
Do never load things in OnRender() this way! As you wrote it, the app loads the file each OnRener() again and again... (60 times a second!!!)


Steve Ancell(Posted 2013) [#4]
Thanks Markus, I just amended my code and added brl.filestream as you suggested, it works in GLFW but I also need to target HTML5. Is there any way of making file I/O work in HTML5 also?.





Steve Ancell(Posted 2013) [#5]
Do never load things in OnRender() this way! As you wrote it, the app loada the file every OnRener() again (60 times a second!!!)


Thanks Midimaster for pointing that out to me, I'm surprised I made that mistake after using Blitz3D for many years, I will double check to make sure I don't make that mistake next time. ;)


Markus(Posted 2013) [#6]
no, i mean html5 is not listet at the targets and maybe not supported.
"Android, iOS, Win8, Glfw, Stdcpp"
you can read/write in the web sandbox with other modul.
also you can expand monkey with your own native target functions,
written by yourself
or copy/paste from other free working source code.


Steve Ancell(Posted 2013) [#7]
Thanks Markus, that self written native function idea may come in handy once I manage to get into monkey properly.


Markus(Posted 2013) [#8]
ok,
did you try brl.databuffer / brl.datastream ?


Steve Ancell(Posted 2013) [#9]
In my second attempt, the one that works with GLFW, I used the following...

Import brl.filestream