| delorie.com/archives/browse.cgi | search |
| From: | mert0407 AT sable DOT ox DOT ac DOT uk (George Foot) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: flushing buffers |
| Date: | Sun, 24 Nov 1996 17:02:59 GMT |
| Organization: | Oxford University |
| Lines: | 17 |
| Message-ID: | <32987d9a.12284418@news.ox.ac.uk> |
| References: | <3297FE31 DOT 34F5 AT freenet DOT carleton DOT ca> |
| NNTP-Posting-Host: | mc31.merton.ox.ac.uk |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
If you don't mind using conio functions instead of stdio ones, you can
do this:
#include <conio.h>
int main(void)
{
while (kbhit()) getch(); // flush buffer before prompting
cprintf("Prompt: "); // prompt
char reply=getch(); // get character; if you use getche() it
// will also be echoed
return 0;
}
I'm not sure about a way to do this without using console functions.
gf
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |