www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/24/02:04:07

Date: Tue, 23 Apr 1996 22:17:33 +0800 (GMT+0800)
From: Orlando Andico <orly AT abigail DOT eee DOT upd DOT edu DOT ph>
To: Gregory Fedor <gfedor AT lerc DOT nasa DOT gov>
cc: djgpp AT delorie DOT com
Subject: Re: Odd printf behaviour
In-Reply-To: <4ljetk$bvh@sulawesi.lerc.nasa.gov>
Message-ID: <Pine.LNX.3.91.960423221544.1326A-100000@abigail.eee.upd.edu.ph>
MIME-Version: 1.0

On 23 Apr 1996, Gregory Fedor wrote:

> I wrote some simple code that utilizes the gotoxy() and printf() 
> statements to place text on the screen, ala:
> 
> 	while(!done)
> 	{
> 		gotoxy(column, line);
> 		printf(" %... ", ...);
> 
> 		// update column
> 		// update line
> 	}
> 
> 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'm stumped, anyone got a hint?
> 
> Thanks
> Gregory
> 
> -------------------------------------------------------------------------------
> Gregory A. Fedor                          ADF Inc. / NASA Lewis Research Center
> Computer Engineer                               Microgravity Experiments
>     work: gfedor AT lerc DOT nasa DOT gov  http://sven.lerc.nasa.gov/~gfedor (216)977-1247
> personal: gfedor AT en DOT com         http://www.en.com/users/gfedor
> 

if i remember the bad old days of turbo c well enough, printf() which is 
a stream io command and gotoxy() which is a console io command don't mix, 
so the things you see are probably just a fluke. also, djgpp buffers 
stdio with a 4k buffer (i think) which adds more complexity. i believe 
what you should do is use curses (there's one for djgpp) and avoid the 
nonportability of the turbo c conio.h functions.


- Raw text -


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