Mail Archives: djgpp/1997/07/05/14:18:33
From: | kalyniuk AT freenet DOT edmonton DOT ab DOT ca ()
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | printf question
|
Date: | 5 Jul 1997 15:04:01 GMT
|
Organization: | Edmonton FreeNet, Edmonton, Alberta, Canada
|
Lines: | 27
|
Message-ID: | <5plnp1$h0g$1@news.sas.ab.ca>
|
NNTP-Posting-Host: | fn2.freenet.edmonton.ab.ca
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Can anyone explain to me why printf() wont immediately print to the screen
after calling clrscr(), unless I use fflush(stdout) first? It works fine
without the fflush() on my Borland compiler.
example:
// this seems to jump straight to getch() without printing "hello
world" first. When the program ends, it then prints out.
#include <stdio.h>
#include <conio.h>
int main(void)
{
clrscr();
printf("Hello World!");
getch(); // or delay(1000); or while(!kbhit()){}
return(0);
}
// if I use fflush(stdout) after clrscr(); then it prints
immediately. It seems that once I've called clrscr() I have to call
fflush() every time I want to printf() something. Am I doing something
wrong?
Any help would be appreciated. Thanks.
Mike. --
- Raw text -