home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!montebello.ecom.unimelb.EDU.AU!carl
- From: carl@montebello.ecom.unimelb.EDU.AU (Carl Brewer)
- Subject: Funny problem with a pause routine
- Message-ID: <9232123.22703@mulga.cs.mu.OZ.AU>
- Sender: news@cs.mu.OZ.AU
- Organization: Computer Science, University of Melbourne, Australia
- Date: Mon, 16 Nov 1992 12:17:15 GMT
- Lines: 38
-
- ok, here's a routine I copied from a book, and can see no reason why
- it won't work, but first, some background ..
-
- compiler, gcc on SunOS 4.1.2, (ANSI)
-
- the bug
-
- it works the first time I call it, but from then it only works if
- I get it to do the getchar() twice ...
-
- otherwise, it just skips over it, and there is no wait for the <cr>
-
-
-
- enough preamble
-
- void pause()
- {
- char ans;
- fflush(stdin);
- fprintf(stdout, "Press <Return> to continue\n");
- ans = getchar();
- fflush(stdin);
-
- return;
- }
-
- I've tried this with the getchar cast to void [ (void)getchar(); ],
- and tried gets(), getc() etc, all to no avail.
-
- any ideas?
-
-
- --
- Annal Natrach, Usthvah Spethed, carl@ecr.mu.oz.au (IRC: Bleve)
- Dochoel Dienve carl@munagin.ee.mu.oz.au
- carl@montebello.ecom.unimelb.EDU.AU
- Merlin, where are you? Call your dragon, to weave a mist...
-