From: Q
Subject: Simple question
Date: 
Message-ID: <1177602900.962262.196540@t38g2000prd.googlegroups.com>
Is there a way to force an EOF character to be at the end of a
stream?  I have an open stream that doesn't have an EOF, so when I try
to read-line it just hangs there.

From: Thomas A. Russ
Subject: Re: Simple question
Date: 
Message-ID: <ymi1wi7yoe2.fsf@sevak.isi.edu>
Q <······@gmail.com> writes:

> Is there a way to force an EOF character to be at the end of a
> stream?  I have an open stream that doesn't have an EOF, so when I try
> to read-line it just hangs there.

No.  Since there isn't any EOF character.

The way you force an EOF to be signaled is to close the stream.  So, you
should close the stream and then read-line will return an EOF result.
This is likely to fail if the stream is something like *terminal-io* or
some other interactive stream which doesn't really end up being closed.


-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: John Thingstad
Subject: Re: Simple question
Date: 
Message-ID: <op.treg3xabpqzri1@pandora.upc.no>
On Thu, 26 Apr 2007 17:55:01 +0200, Q <······@gmail.com> wrote:

> Is there a way to force an EOF character to be at the end of a
> stream?  I have an open stream that doesn't have an EOF, so when I try
> to read-line it just hangs there.
>

yes. (force-output) also see (force-input)

Here is a simple game that demonstates use.
http://home.chello.no/~jthing/games/roulette.html

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From: Rob Warnock
Subject: Re: Simple question
Date: 
Message-ID: <ba-dnVJI3vNIMqzbnZ2dnUVZ_sHinZ2d@speakeasy.net>
John Thingstad <··············@chello.no> wrote:
+---------------
|  Q <······@gmail.com> wrote:
| > Is there a way to force an EOF character to be at the end of a
| > stream?  I have an open stream that doesn't have an EOF, so when I try
| > to read-line it just hangs there.
| 
| yes. (force-output) also see (force-input)
+---------------

What is this "FORCE-INPUT" of which you speak?  ;-}  ;-}
It's not in the CLHS.

+---------------
| Here is a simple game that demonstates use.
| http://home.chello.no/~jthing/games/roulette.html
+---------------

Uh... That demonstrates CLEAR-INPUT, not FORCE-INPUT.
And CLEAR-INPUT only clears the input buffer, it doesn't
force an EOF on the stream, which is what the OP was asking.


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Rainer Joswig
Subject: Re: Simple question
Date: 
Message-ID: <joswig-CAA285.18404428042007@news-europe.giganews.com>
In article <································@speakeasy.net>,
 ····@rpw3.org (Rob Warnock) wrote:

> John Thingstad <··············@chello.no> wrote:
> +---------------
> |  Q <······@gmail.com> wrote:
> | > Is there a way to force an EOF character to be at the end of a
> | > stream?  I have an open stream that doesn't have an EOF, so when I try
> | > to read-line it just hangs there.
> | 
> | yes. (force-output) also see (force-input)
> +---------------
> 
> What is this "FORCE-INPUT" of which you speak?  ;-}  ;-}
> It's not in the CLHS.

I've used it once. The users were getting a short but
strong electrical shock. Unfortunately their input was not readable.
See also *input-readably* .

> 
> +---------------
> | Here is a simple game that demonstates use.
> | http://home.chello.no/~jthing/games/roulette.html
> +---------------
> 
> Uh... That demonstrates CLEAR-INPUT, not FORCE-INPUT.
> And CLEAR-INPUT only clears the input buffer, it doesn't
> force an EOF on the stream, which is what the OP was asking.
> 
> 
> -Rob
> 
> -----
> Rob Warnock			<····@rpw3.org>
> 627 26th Avenue			<URL:http://rpw3.org/>
> San Mateo, CA 94403		(650)572-2607

-- 
http://lispm.dyndns.org
From: John Thingstad
Subject: Re: Simple question
Date: 
Message-ID: <op.trfnfzk8pqzri1@pandora.upc.no>
On Thu, 26 Apr 2007 18:51:23 +0200, John Thingstad  
<··············@chello.no> wrote:

> On Thu, 26 Apr 2007 17:55:01 +0200, Q <······@gmail.com> wrote:
>
>> Is there a way to force an EOF character to be at the end of a
>> stream?  I have an open stream that doesn't have an EOF, so when I try
>> to read-line it just hangs there.
>>
>
> yes. (force-output) also see (force-input)
>
> Here is a simple game that demonstates use.
> http://home.chello.no/~jthing/games/roulette.html
>

(clear-input) and Russ is right.
The problem I was thinking of isn't really what you asked.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/