- Home /
Creating a file and writing into it? :p
Hello guys :O!
The title actually explains everything ^.^
thanks in advance
h4wkeye
Answer by Wibbs 1 · Apr 07, 2011 at 10:27 AM
You can use System.IO...
import System.IO;
Then you can use the different readers and writers depending on exactly what you want to do.
Look here for a reference...
edit(moved from comment)
#pragma strict import System.IO;
public static class SimpleLogger extends ScriptableObject { public function Start() { if (sw!=null) { return; } try { sw = new StreamWriter(Application.dataPath + "/log.txt"); } catch (e : Exception) { //error handling } } public function LogMessage(message:String) { try { sw.WriteLine(message); } catch (e : Exception) { // error handling } finally { sw.Flush(); } } public function Stop() { sw.Close(); } private var sw : StreamWriter = null; }
the given functions are not supported in java script >.> example code for java pls?