[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



> Hej Peter
>
> Kunne en eller anden venlig sjæl fortælle mig, hvordan man flusher stdin.
> Jeg læser med et bestemt interval det første tegn fra stdin. Derefter vil
> jeg gerne flushe den.

I ISO/IEC 14882(1998E) compliant C++ code ville jeg skrive:
for (;cin.rdbuf()->in_avail(); cin.rdbuf()->sbumpc());

Nu er ISO/IEC 14882 compliant C++ libraries && compilers ikke sådan at få fat i
(Jeg har i samme anledning netop afsendt en bug report til Borland)

Dybest set besvarer dette ikke dit spørgsmål der drejer sig om C og ikke
teoretisk C++.

> Når jeg så venter en stykke tid og læser igen, kan jeg altså være sikker på,
> at det tegn jeg læser er tastet i det tidsrum, hvor programmet har sovet.
> fflush(stdin) virker ikke, men stdin er vel heller ikke en output / updtate,
> men en input stream.

Hvad gælder sockets har jeg løst ovenstående -- men det er desværre stadig ikke
det du spørger om!

> --
>         Peter Seidler

Hej fra Nils!




 
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] *