| delorie.com/archives/browse.cgi | search |
| Message-ID: | <37845F8C.9C343DFB@homemail.com> |
| From: | Matthew Haley <mhaley99 AT homemail DOT com> |
| X-Mailer: | Mozilla 4.08 [en] (Win16; I) |
| MIME-Version: | 1.0 |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Flushing input stream? |
| References: | <37819F79 DOT 72629349 AT singmail DOT com> |
| Lines: | 27 |
| Date: | Thu, 08 Jul 1999 08:21:33 +0000 |
| NNTP-Posting-Host: | 209.181.108.113 |
| X-Trace: | news.uswest.net 931447514 209.181.108.113 (Thu, 08 Jul 1999 10:25:14 CDT) |
| NNTP-Posting-Date: | Thu, 08 Jul 1999 10:25:14 CDT |
| Organization: | U S WEST Interprise |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Since I haven't seen anyone post it yet. If portability is not a problem
what about trying this:
while(kbhit()) getch();
This will flush the keyboard buffer and stop as soon as there are no
more keys left.
IIRC, kbhit() is in conio.h
Chih Hui wrote:
>
> Hi, how do I flush the standard input stream in DJGPP? In other
> compilers, I could use the non-standard way by using fflush(stdin).
> Thanks.
>
> main(){
> char ch1, ch2;
>
> printf("Enter a letter: ");
> ch1 = getchar();
>
> /* flush input here */
>
> printf("Enter another letter: ");
> ch2 = getchar();
> }
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |