Page 1 of 1

"\n" and "\r"

Posted: Thu Feb 02, 2006 7:40 pm
by alex
I use WindowsXP and have simple program in file test.lsp:

Code: Select all

(print "\n\n\n\n\n")
(exit)
I run cmd.exe and execute command

Code: Select all

newlisp test.lsp > test.txt
Then I see, that size of file test.txt is 10 and it contain
"\n\r\n\r\n\r\n\r\n\r"
It is normal?

Posted: Thu Feb 02, 2006 8:06 pm
by Lutz
Yes, this is normal: it will translate UNIX line terminators "\n" to "\r\n" line terminators on the MS-Windows platform.

Keep this in mind when porting newLISP scripst to UNIX, if they run as shell scripts with:

#!/usr/bin/newlisp

in the first line, they will fail if they have Windows line terminators, and have to be translated first (i.e. using dos2unix)

Lutz

Posted: Sat Feb 04, 2006 3:08 pm
by alex
I can't express my mind in english enough,
but it is very interesting information not only for me :-)