[plt-scheme] copy-port and custom-port

From: YC (yinso.chen at gmail.com)
Date: Wed Jul 23 15:19:26 EDT 2008

On Wed, Jul 23, 2008 at 12:05 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:

> > I thought I allocated `bytes-in` & `peeked` based on the `len`, so `len`
> can
> > be returned - apparently that's not the case?  What did I miss?
> You computed `len' based on the given byte string, but that byte
> string's length might be larger than the number of bytes available in
> the port. The result should be the number of bytes actually read or
> peeked.
I see - I actually thought `len` always equals 1.  When I wrote the code I
traced `read-in` and observed the size of given bytes; I must have been
reading the port with `read-byte` at the time - that was my
misunderstanding.  Now that you explained it it's clear where the random
bytes came from - `copy-port` uses a much larger buffer...

Thanks again! ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080723/ede66621/attachment.html>

Posted on the users mailing list.