Thanks Holger,
I was able to modify my script to include copy/part port 1 and then add
some logic which got it working without a hitch and got rid of the past-end
message. The logic was just an added line:
if irc-input-buffer = block! [irc-input-buffer: to-string irc-input-buffer]
Paul Tretter
P.S. - This should probably get added to the /Core docs some day depending
on how it changes in the next release.
----- Original Message -----
From: "Holger Kruse" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 14, 2001 5:26 PM
Subject: [REBOL] Re: open/lines
> On Sun, Jan 14, 2001 at 04:20:43PM -0600, Paul Tretter wrote:
> >
> > If I used open/line/direct/no-wait I get a block when doing a:
> >
> > copy port
> >
> > I get a string when I do:
> >
> > copy first port
> >
> > My question is how do I use copy port and convert it to get the same
output that copy first provides in a string format without generating a
past-end error.
>
> Here is the behavior for ports in line/direct/no-wait:
>
> copy returns a block of all lines waiting to be read, and removes them
from the port
> buffer. Each element of the block is one line. If no lines are waiting
then an empty
> block is returned. If the other end has closed the connection then none is
returned.
>
> "first port" is a shortcut for "pick port 1". It returns the next line and
removes it from
> the buffer. The result is none either if no data is pending (this will
probably change in the
> next version) or if the end of the stream has been reached. You don't need
to "copy" the
> result.
>
> If you want to be able to distinguish between no data and eof, but still
want only a single
> line returnd to you at a time, then use "copy/part port 1". If the
returned value is a block
> then it is either empty or has exactly one item in it, which you can
access using "first".
>
> --
> Holger Kruse
> [EMAIL PROTECTED]
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.