www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/17/10:01:33.1

From: "Arthur" <arfa AT clara DOT net>
To: <djgpp AT delorie DOT com>
Subject: RE: printf in DJGPP
Date: Sat, 17 Oct 1998 14:58:02 +0100
Message-ID: <000101bdf9d6$27d61120$764e08c3@arthur>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
In-Reply-To: <19981017022116.25669.00002002@ng112.aol.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

> I am using printf in my programs just to debug my code.  Uno,
> printf("\n%d",test);  just to see if the value is the right one
> at run time.
> And sometimes, for some strange reason, the output turns up after
> the part of
> the program that I put it in.

DJGPP uses buffered output, because it is very slow to do i/o in a virtual
memory system. This means that the stdout buffer is not output to the screen
until you force it. This includes a \n, so using printf("\n%d\n",test);
should work. Otherwise you could use fflush(NULL); which would make printf
work as expected.

James Arthur
jaa AT arfa DOT clara DOT net
ICQ#15054819

- Raw text -


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