home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / c / 11700 < prev    next >
Encoding:
Internet Message Format  |  1992-07-29  |  2.4 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!wupost!sdd.hp.com!zeus.ieee.org!fsbbs!f408.n107.z1.ieee.org!Joe.Thibault
  2. From: Joe.Thibault@f408.n107.z1.ieee.org (Joe Thibault)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: prompts
  5. Message-ID: <15327.2A767BAA@zeus.ieee.org>
  6. Date: 26 Jul 92 17:18:00 GMT
  7. Sender: news
  8. Organization: FidoNet node 1:107/408 - Starcom Syste, Eatontown NJ
  9. Lines: 59
  10.  
  11. RO>From: ross@zooid.guild.org (Ross Ridge)
  12. RO>Date: 19 Jul 92 19:32:35 GMT
  13. RO>Organization: ZOOiD BBS
  14. RO>Message-ID: <1992Jul19.193235.20528@zooid.guild.org>
  15. RO>Newsgroups: comp.lang.c
  16.  
  17. RO>sprice@eng.auburn.edu (Shannon W. Price) writes:
  18. RO>>In a program that I've been working on, I'd like to be able to prompt a
  19. RO>>user like this :
  20. RO>>
  21. RO>>       Press <ENTER> to continue
  22. RO>>
  23. RO>>First I thought that I could just do a scanf ("%c",&prompt) and that
  24. RO>>would take care of it.
  25.         How about the generic "gotoxy(24,25);
  26.                                Cprintf("Press <ENTER> to continue"); (or
  27.                                declare that string as a constant...)
  28.  
  29.  
  30. RO>Try:
  31.  
  32. RO>        scanf("%*[^\n]");
  33. RO>        getchar();
  34.  
  35. RO>>  How does one go about accepting menu commands sometimes
  36. RO>>and just a carriage return at other times?
  37.  
  38. RO>In general scanf is a very poor function to use to read user input.
  39. RO>It is the compliment of printf in only that it can be handy to use
  40. RO>to read printf output.
  41.  
  42. RO>                                                        Ross Ridge
  43.  
  44. RO>--
  45. RO>Ross Ridge - The Great HTMU                                          l/  //
  46. RO>                                                                   
  47. [OO][oo]
  48. RO>ross@zooid.guild.org                                               
  49. /()\/()/
  50. RO>uunet.ca!zooid!ross                                                  db  //
  51.  
  52. RO>--- AMB v6.33
  53. RO> * Origin: zeus.ieee.org (1:107/10)
  54.      I assume you're using a switch statement to select menu choices...
  55.      Use "Cgetch" (#include <conio.h>) to read the keyboard, and add the
  56.      following case statement:
  57.                         case 0x1c0d :      /* Return key pressed*/
  58.                                 DesiredFunction();
  59.                                 return;
  60.  
  61.                         Hope it helps...                Joe T.
  62.  
  63.  ~ SLMR 2.1a ~ Windows:  A colorful clown suit for DOS.
  64.  
  65.  
  66.  
  67. --  
  68. =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  69.  Joe Thibault - Internet: Joe.Thibault@f408.n107.z1.ieee.org
  70.