[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Flushing af stdin



Peter Seidler wrote:
> 
> On Tue, 30 May 2000 20:11:37 +0200, Egon Andersen, Talura wrote:
> >Frank Damgaard wrote:
> >>
> >> In article <sslug@sslug> you wrote:
> >>
> >> Jeg vil foreslå at du bruger en løkke med  select() og så read().
> >>
> >> ....
> >>
> >> >       if (ch != EOF)
> >> >               while (getchar() != EOF)
> >>
> >> > og det er sådan set præcis det jeg gerne vil - bare med et enkelt kald.
> >> > Hvis man ikke kan det bruger jeg bare ovenstående.
> >>
> >> Bortset fra at så er input slut, og der er ikke mere at komme efter,
> >> så hvorfor overhovedet lave en "flush/purge" ?
> >>
> >> --
> >> mvh Frank Damgaard  | http://home3.inet.tele.dk/frda/
> >
> >Jeg må give Frank ret, selvom det var mig der foreslog getchar().
> >Den funker ikke!
> 
> Kald mig idiot, men hvorfor gør det ikke det?
> 
> >
> >/Egon
> >
> 
> --
>         Peter Seidler

Vi kalder ikke nogen noget :-)
Hvis stdin er keyboardet, så kommer programmet aldrig ud af
while-loop'en :-(
Hvis stdin er en fil, så læser den til enden af filen og så er der sådan
set ikke mere i filen.
Desuden er problemet med getchar(), at den skal have et 'return' før den
læser første character og det er vist ikke det du ønsker.

(Nu har jeg vist efterhånden beskrevet hvorfor mit eget forslag ikke
fungerer :-)

/Egon


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *