0

In clisp, I can do something like this:

(with-open-file (fred "fred-unix"
                  :direction :output
                  :if-exists :supersede
                  :external-format :unix)
  (format fred "lf only~%"))
(with-open-file (fred "fred-mac"
                  :direction :output
                  :if-exists :supersede
                  :external-format :mac)
  (format fred "cr only~%"))
(with-open-file (fred "fred-dos"
                  :direction :output
                  :if-exists :supersede
                  :external-format :dos)
  (format fred "cr/lf~%"))

sbcl chokes on this; it doesn't know about :unix or :mac or :dos. Is there any way I can do this in sbcl?

Rainer Joswig
  • 136,269
  • 10
  • 221
  • 346
Bill Evans at Mariposa
  • 3,590
  • 1
  • 18
  • 22
  • 3
    You can print `#\return` and `#\linefeed` characters manually. `~%` prints a `#\newline`, which picks the correct choice for the current platform. – jkiiski Sep 06 '17 at 18:30
  • 1
    @jkiiski: `which picks the correct choice for the current platform`- would SBCL do that? IIRC it uses Unix conventions on Windows, too. – Rainer Joswig Sep 14 '17 at 07:22
  • @RainerJoswig You may be right. I don't have a Windows to test on, so I was just assuming SBCL would ["take the appropriate action to produce a line division"](http://www.lispworks.com/documentation/HyperSpec/Body/13_ah.htm). – jkiiski Sep 14 '17 at 07:47

0 Answers0