Another approach is to read the port in line by line via read-line with 'any, which removes the line terminator for you, and then you can add the os-specific line terminator, below shows how to do so with +:windows. <div>
<br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div><font class="Apple-style-span" face="'courier new', monospace">(require (planet bzlib/os)) ;; use +:windows to specify os-based branching </font></div>
</div><div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div></div><div><div><font class="Apple-style-span" face="'courier new', monospace">(define (copy-lines in out) ;; out is in binary mode </font></div>
</div><div><div><font class="Apple-style-span" face="'courier new', monospace"> (let loop ((line (read-line in 'any)))</font></div></div><div><div><font class="Apple-style-span" face="'courier new', monospace"> (unless (eof-object? line)</font></div>
</div><div><div><font class="Apple-style-span" face="'courier new', monospace"> (write-string (format (+:windows "~a\r\n" "~a\n") ;; if windows use \r\n, else use \n </font></div></div><div>
<div><font class="Apple-style-span" face="'courier new', monospace"> line) out)</font></div></div><div><div><font class="Apple-style-span" face="'courier new', monospace"> (loop (read-line in 'any)))))</font></div>
</div></blockquote><div><br></div><div>Cheers,</div><div>yc<br><br><div class="gmail_quote">On Sun, Dec 5, 2010 at 12:42 AM, Noel Welsh <span dir="ltr"><<a href="mailto:noelwelsh@gmail.com">noelwelsh@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">My guess is the LF in the source is being converted to CRLF, and<br>
indeed this is what the docs state. I think doing a regexp-replace*<br>
directly on the port is probably the easiest and most efficient thing<br>
to do.<br>
<br>
HTH,<br>
N.<br>
<div class="im"><br>
On Sun, Dec 5, 2010 at 8:01 AM, Michael Coppola<br>
<<a href="mailto:coppola.mi@husky.neu.edu">coppola.mi@husky.neu.edu</a>> wrote:<br>
> Hi everyone,<br>
><br>
> I am using the function "open-output-file" in conjunction with<br>
> "copy-port" to take incoming data from a TCP port and write it to a<br>
> file, but I am running into an issue. In my code, I offer the user the<br>
</div>> option of saving the file by means o...</blockquote></div>
</div>