home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / os2 / programm / 4750 < prev    next >
Encoding:
Text File  |  1992-09-07  |  1.2 KB  |  47 lines

  1. Path: sparky!uunet!pmafire!news.dell.com!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!olivea!sgigate!sgiblab!tsoft!dennis
  2. From: bbs.dennis@tsoft.sf-bay.org (Dennis Yelle)
  3. Newsgroups: comp.os.os2.programmer
  4. Subject: getch() + Ctrl-C == locked program
  5. Message-ID: <uDgLqB2w165w@tsoft.sf-bay.org>
  6. Date: 4 Sep 92 20:35:29 GMT
  7. Sender: bbs@tsoft.sf-bay.org (BBS User)
  8. Organization: The TSoft BBS and Public Access Unix, +1 415 969 8238
  9. Lines: 36
  10.  
  11. #if 0
  12. When I compile this program with:
  13.     icc /B"/st:0x08000" /Sm getch.c
  14. and run it with:
  15.     getch
  16. It works OK unless I type a Ctrl-C.
  17.  
  18. If I type a Ctrl-C the program locks up and ignores all
  19. other characters, and I can not get rid of the program.
  20.  
  21. I do not care if getch() returns the control-c to me or not,
  22. but I do not want it to hang.
  23.  
  24. Can anyone help me with this problem?
  25. #endif
  26.  
  27. #include <conio.h>
  28. #include <stdio.h>
  29. #include <stdlib.h>
  30.  
  31. main( int argc, char **argv)
  32. {
  33.         int c;
  34.         
  35.         argc = argc;
  36.         argv = argv;
  37.         
  38.         printf( "Please press a key>");
  39.         fflush( stdout);
  40.         c = getch();
  41.         printf( "\n" "thanks for the 0x%02X.\n", c);
  42.         return 0;
  43. }
  44.  
  45. --
  46. Dennis Yelle (bbs.dennis@tsoft.sf-bay.org)
  47.