🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #10949

Ctrl-D in input

#10949
From: Andrew Schorr
Date: Tue, 14 Feb 1989 23:54
17 lines
1246 bytes
As usual, a question that is probably trivial for those who know the
answer:

If some irresponsible user types a Ctrl-D to your program, how can you
continue as if this had never been typed?

Currently, I do nothing.  Unfortunately, this makes my program go haywire
(it keeps detecting an EOF condition on stdin).  If I close stdin, there
is no problem, but the user can no longer interact with the program.

Thanks in advance,
Andrew Schorr <beareq!schorr@wheaties.ai.mit.edu>

[[ Try "clearerr(stdin)".  That should clear the EOF condition and allow
you to continue reading from the stream.  Of course you have to be careful
to make sure that you aren't really reading from a file.  You might get
stuck in a infinite loop.  Read ferror(3S).  --wnl ]]
Technical Details
Message-ID: <8902062227.AA01214@quants4>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request
From: beareq!quants4!schorr@wheaties.ai.mit.edu (Andrew Schorr)
Newsgroups: comp.sys.sun
Subject: Ctrl-D in input
Message-ID: <8902062227.AA01214@quants4>
Date: 14 Feb 89 23:54:05 GMT
Sender: usenet@rice.edu
Organization: Sun-Spots
Lines: 17
Approved: Sun-Spots@rice.edu
Original-Date: Mon, 6 Feb 89 17:27:04 EST
X-Sun-Spots-Digest: Volume 7, Issue 155, message 15 of 18