<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Thanks Noel and YC for your quick replies.<br>
<br>
I'm testing out your code, YC, and it seems like it's exactly what I
need. I wasn't aware of bzlib/os, so that was really helpful.
Thank you!<br>
<br>
MC<br>
<br>
On 12/05/2010 04:11 AM, YC wrote:
<blockquote
cite="mid:AANLkTimPQKdh41PenNYNTQ1_m3Xd+6aGxVRjkuczxHFt@mail.gmail.com"
type="cite">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: 0pt
0pt 0pt 40px; border: medium 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 moz-do-not-send="true"
href="mailto:noelwelsh@gmail.com">noelwelsh@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
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 moz-do-not-send="true"
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>
</blockquote>
</body>
</html>