home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!wupost!sdd.hp.com!zeus.ieee.org!fsbbs!f408.n107.z1.ieee.org!Joe.Thibault
- From: Joe.Thibault@f408.n107.z1.ieee.org (Joe Thibault)
- Newsgroups: comp.lang.c
- Subject: Re: prompts
- Message-ID: <15327.2A767BAA@zeus.ieee.org>
- Date: 26 Jul 92 17:18:00 GMT
- Sender: news
- Organization: FidoNet node 1:107/408 - Starcom Syste, Eatontown NJ
- Lines: 59
-
- RO>From: ross@zooid.guild.org (Ross Ridge)
- RO>Date: 19 Jul 92 19:32:35 GMT
- RO>Organization: ZOOiD BBS
- RO>Message-ID: <1992Jul19.193235.20528@zooid.guild.org>
- RO>Newsgroups: comp.lang.c
-
- RO>sprice@eng.auburn.edu (Shannon W. Price) writes:
- RO>>In a program that I've been working on, I'd like to be able to prompt a
- RO>>user like this :
- RO>>
- RO>> Press <ENTER> to continue
- RO>>
- RO>>First I thought that I could just do a scanf ("%c",&prompt) and that
- RO>>would take care of it.
- How about the generic "gotoxy(24,25);
- Cprintf("Press <ENTER> to continue"); (or
- declare that string as a constant...)
-
-
- RO>Try:
-
- RO> scanf("%*[^\n]");
- RO> getchar();
-
- RO>> How does one go about accepting menu commands sometimes
- RO>>and just a carriage return at other times?
-
- RO>In general scanf is a very poor function to use to read user input.
- RO>It is the compliment of printf in only that it can be handy to use
- RO>to read printf output.
-
- RO> Ross Ridge
-
- RO>--
- RO>Ross Ridge - The Great HTMU l/ //
- RO>
- [OO][oo]
- RO>ross@zooid.guild.org
- /()\/()/
- RO>uunet.ca!zooid!ross db //
-
- RO>--- AMB v6.33
- RO> * Origin: zeus.ieee.org (1:107/10)
- I assume you're using a switch statement to select menu choices...
- Use "Cgetch" (#include <conio.h>) to read the keyboard, and add the
- following case statement:
- case 0x1c0d : /* Return key pressed*/
- DesiredFunction();
- return;
-
- Hope it helps... Joe T.
-
- ~ SLMR 2.1a ~ Windows: A colorful clown suit for DOS.
-
-
-
- --
- =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
- Joe Thibault - Internet: Joe.Thibault@f408.n107.z1.ieee.org
-