[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] getch() virker ikke



> On Thu, 2003-12-04 at 13:52, Egon Petersen wrote:
> > Jeg er ved at lære mig OOP med C++. Jeg har fået en opgave der
> > ligesom lægger op til at man skal bruge getch().
> 
> Hvorfor ikke bruge:
> 
>                cin >> valg  eller  cin.get ()

skal de ikke have EOL for at stoppe med at modtage input? 

Dette er et tilbagevendende spørgsmål!

*Nej*! der er ikke i ISO/IEC14882(E) dvs i C++ defineret 
nogen måde hvorpå at man sætter en process i venteposition indtil en andet 
end '\n' er blevet sat i kø.

C++ specifikationen rummer dog en teoretisk mulighed via 
cin.rdbuf()->in_avail() at teste om der er sat noget i keyboard bufferen.
Jeg har endnu ikke set en implementation på nogen platform der honorerer 
denne mulighed (det ville jo også være at opfordre follk til at "polle";-)

At sætte en process i venteposition er platformsafhænging -- på Linux 
ville jeg bruge select(.) på mswin32 ville jeg bruge 
WaitForMultipleObjects(.)

Svaret på spørgsmålet er så platformsafhængingigt at C++ har "opgivet" at 
lave en standard for det;-)






Kim Schulz <sslug@sslug>
04-12-03 14:38
Please respond to sslug-cprog

 
        To:     sslug@sslug
        cc: 
        Subject:        Re: [CPROG] getch() virker ikke

On Thu, 04 Dec 2003 14:23:35 +0100
Henrik Brix Andersen <sslug@sslug> wrote:





 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:10 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] *