write-line outputs CRCRLF on my XP box

Started by John_Small, May 31, 2007, 05:03:03 PM

Previous topic - Next topic

John_Small

Hi,



I'm using version 9.1.1 on windows XP.



  (write-line "")



and



   (println "")



both output a three character sequence



      CRCRLF



instead of just



     CRLF



Is there something I'm doing wrong?

Lutz

#1
The extra CR is added by Windows in piping situations, newLISP itself only outputs CR-LF (on UNIX only LF). Try this to verify:



> (device (open "test.txt" "w"))
3
> (println "hello")
"hello"
> (close (device))
true
> (set 's (read-file "test.txt"))
"hellorn"
>


You also can verify this using write-line to a file or to a string buffer and will get the same result.



I found out about this years ago when doing CGI work on Windows. If you pipe your STDOUT to a file, Windows will add that extra CR before all LF. The only way around it is stripping it off with a (replace {rrn} buffer {rn}).



Lutz

rickyboy

#2
Hey John_Small,



Are you the same John Small who used to be user jsmall here and who wrote the newLISP tutorial?  If so, how come the new username (John_Small)?



Curious,

--Rick
(λx. x x) (λx. x x)