delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/07/18/07:08:10

Date: Tue, 18 Jul 1995 13:33:15 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "Dr. Brain" <dr DOT brain AT iol DOT it>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: DJGPP's stdout file

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 -


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