delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/27/00:01:20

From: myknees AT aol DOT com (Myknees)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: readkey() problem
Date: 27 Jan 1998 04:49:01 GMT
Lines: 27
Message-ID: <19980127044900.XAA02691@ladder02.news.aol.com>
NNTP-Posting-Host: ladder02.news.aol.com
References: <19980127005001 DOT TAA19938 AT ladder01 DOT news DOT aol DOT com>
Organization: AOL http://www.aol.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <19980127005001 DOT TAA19938 AT ladder01 DOT news DOT aol DOT com>, qballlives AT aol DOT com
(QBallLives) writes:

>I believe that's a buffering issue... but I'm too tired to think of the
>command
>to use to clear that buffer out... my friend dhonn has keyboard
>routines code
>that I believe does the flush you need done...
>his page:


If it is a buffering issue, as in the classic...
#include <stdio.h>
#include <conio.h>
int main()
{
   printf("foo"); 
   getch();    /* waits for a key, no "foo'' visible to user */
   return 0;   /* "foo" comes only when the program exits */
                  /* and buffer is flushed */
}
...then (this is a long sentence!) you could use cprintf(), which is a
non-buffered function in conio.h, instead of printf(), or you could use this:
fflush(stdout);  /* flushes the buffer to stdout */
...before you call printf().  

--Ed (Myknees)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019