[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] key pressed (was: c++ og standard libraries



Hej Hans

Den Thu, 09 Oct 2003 20:29:20 +0200, skrev Hans Schou:


> 
> c = getchar(); /* er måske noget du søger */

Det var lige det magiske buzzword. Det og c++ googlede mig lige frem til
det eksempel jeg lige har brug for-

/* getchar example : typewriter */
#include <stdio.h>

int main ()
{
  char c;
  puts ("Enter text. Include a dot ('.') in a sentence to exit:");
  do {
    c=getchar();
    putchar (c);
  } while (c != '.');
  return 0;
}

Samme princip som dit eksempel bare lidt mere overskueligt

> men den er pokkers besværlig at bruge, så jeg har lavet et eksempel:
> http://www.sslug.dk/~chlor/keypressed.c
> 
> Hvis du vil stoppe dit program og enten vente på at en fil kommer med 
> data eller der bliver trykket på en tast, så skal du nok bruge noget 
> med select(2). Jeg har også et eksempel med det.
hvor er det` 
> /hans
Tak for hjælpen


Chris


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

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