Mail Archives: djgpp/1995/07/18/07:08:10
On Sun, 16 Jul 1995, Dr. Brain wrote:
> I've got a problem porting BolrandC programs to DJGPP: if I don't
> specify setbuf(stdout, NULL) in DJGPP I have a buffered output, that
> can't be seen until the newline is printed...
What's wrong with buffering stdout, especially from a protected-mode
program where every write requires a switch from protected to real mode
and back? If your program only writes to the screen, you shouldn't use
buffered I/O in the first place: use the conio functions like cputs(),
cprintf() and the like, which write directly to the video memory. OTOH,
if your program should be able to redirect its output to a file or a pipe
(which are the same under DOS), then it doesn't make sense to make the
output unbuffered, unless you check what isatty() or some similar call
returns.
- Raw text -