home *** CD-ROM | disk | FTP | other *** search
- Path: sparky.navsea.navy.mil!matuli_a
- From: matuli_a@marlin.navsea.navy.mil (Alex Matulich 03T1 602-6691)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: The easiest C Program ever!!
- Date: 16 Feb 1996 16:40:08 GMT
- Organization: Naval Sea Systems Command Code 03T1
- Message-ID: <4g2c18$8ct@sparky.navsea.navy.mil>
- References: <311.6610T1012T295@in.net>
- NNTP-Posting-Host: marlin.navsea.navy.mil
-
- In article <311.6610T1012T295@in.net>, John J. Maver, Jr. <mave@in.net> wrote:
- > How do I do a "Press enter to continue" in plain old ANSI C? I have
- >got SAS6.56.
- >
- > printf("Please press enter to continue\n");
- > while ((c=getchar()) != '\n' )
- > ;
-
- It's best, I found, to use fgets(). As in
-
- char c[80];
- printf("Press RETURN to continue\n");
- fgets(c, 80, stdin);
-
- This way the user can press anything and the routine won't return until
- he presses RETURN.
-
- If you use getchar() you might have to fflush(stdin) after each loop.
-
- --
- /|
- Alex Matulich __. __=#|| ___ _o--
- matuli_a@marlin.navsea.navy.mil ____##_/_____|==###===###____
- \____________________________\
-