file output on windows xna

Monkey Targets Forums/XNA/file output on windows xna

smilertoo(Posted 2012) [#1]
does anyone have an example of how to write a .txt file using monkey output for xna for windows?


Raz(Posted 2012) [#2]
Monkey currently doesn't support file writing for XNA, but the C# code for doing such a thing would be

FileStream fs = new FileStream(Application.StartupPath + "\\test.txt", FileMode.Create);  
StreamWriter sw = new StreamWriter(fs);  
 
sw.WriteLine("This is a test");  
sw.WriteLine("This is only a test");  
 
sw.Close();  
fs.Close();


Do you need to be using XNA?


smilertoo(Posted 2012) [#3]
glfw would be fine if i could work out how to get it going. Im just looking to output data from map editor/font editor.


Raz(Posted 2012) [#4]
Do you have BlitzMax smilertoo? I'm not sure if the Monkey Max target supports it yet, but it would definitely be able to if it were implemented.


dave.h(Posted 2012) [#5]
you can create txt files in glfw if you use the os module

os.SaveString(s, CurrentDir() + "/lev10.txt")

s being the string.

i use this in a map editor and the above line saves all my data to a txt file called lev10.txt in the current directory.


smilertoo(Posted 2012) [#6]
thanks, this looks usable, all i need now is to work out how to get glfw to work.
I do own bmax but i havn't seen any option for a bmax target.


Raz(Posted 2012) [#7]
Smilertoo : http://code.google.com/p/monkey-max/ it's a user made target :)

However, it currently doesn't support the OS module, so ignore me for now!