var file = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties) .get("AChrom", Components.interfaces.nsIFile); //.get("DeskP", Components.interfaces.nsIFile); file.append("t.txt"); var strm = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream); strm.QueryInterface(Components.interfaces.nsIOutputStream); strm.QueryInterface(Components.interfaces.nsISeekableStream); strm.init( file, 0×04 | 0×08 | 0×10, 420, 0 ); strm.write(str,str.length ); strm.flush(); strm.close(); function read(readfile) { var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath(readfile); var is = Components.classes["@mozilla.org/network/file-input-stream;1"] .createInstance(Components.interfaces.nsIFileInputStream); is.init(file, 0×01, 00004, null); var sis = Components.classes["@mozilla.org/scriptableinputstream;1"] .createInstance(Components.interfaces.nsIScriptableInputStream); sis.init(is); var [...]








