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.
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
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/
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
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
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/