www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/24/01:29:03

Message-Id: <199604240514.BAA09987@styx.ios.com>
Mime-Version: 1.0
Date: Wed, 24 Apr 1996 01:13:05 -0400
To: gfedor AT lerc DOT nasa DOT gov (Gregory Fedor), djgpp AT delorie DOT com
From: Ian Viemeister <vmeister AT ios DOT com>
Subject: Re: Odd printf behaviour

At 08:35 PM 4/23/96 GMT, Gregory Fedor wrote:
>I wrote some simple code that utilizes the gotoxy() and printf() 
>statements to place text on the screen, ala:
>[SNIP]
>When I run this type of code nothing appears on the screen.  I can see 
>the cursor jumping around, but nothing else.  However, if I include a 
>'\n' in the printf statement, things display fine, *or* as soon as I 
>printf with a '\n' outside the loop, then **all** the text gets 
>displayed.  It's almost as if it's being buffered, and isn't displayed 
>until a '\n' comes along.

I beleive that it *is* getting buffered (I ran into the same problem 
doing some stuff in C++, and I ended up doing a cout.flush() whenever 
I needed to ensure that output appeared on the screen)  There may well 
be a better solution than flushing each time, probably turning off the 
4k buffer, check the FAQ for possible info.

Ian
vmeister AT ios DOT com
http://ios.com/~vmeister/

- Raw text -


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