string on a new line (I/O file)
YudinEd
Posts: 90
var sPath = FileDialog.doFileDialog(false);file = new DzFile( sPath );file.open( file.WriteOnly );var str1="1th string";var str2="\n 2th string";file.writeLine(str1+str2);file.close();
Hi! Why does not work \n ? How can I write a string on a new line?
Post edited by YudinEd on
Comments
Works for me. Are you perhaps using a text editor that requires a carriage return and a line feed for a new line to view the output?
Thanks for answer. I did use the Notepad and the Wordpad (default text editors in Windows 7) - it don't work :(
It worked in TextPad - Notepad is quite limited.
Using Win7 Pro I it works, partially.
Viewing in Notepad I see:
(when I C/P that in here I get the linefeed)
Viewing in Wordpad I see:
Smacks very much of what Richard says - Windows 'wants' crlf (\r\n) as a 'proper' end of line, and if I add a \r immediately before the \n and re-run then Notepad does show the linefeed.
Thanks. \r\n is fine working. In Notepad too :)