www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/02/18:01:39

Reply-To: <arfa AT clara DOT net>
From: "Arthur" <arfa AT clara DOT net>
To: "DJGPP Mailing List" <djgpp AT delorie DOT com>,
"James Dominy" <jdominy AT saturn DOT cs DOT unp DOT ac DOT za>
Subject: RE: Strange results from printf()
Date: Wed, 2 Sep 1998 23:01:27 +0100
Message-ID: <000001bdd6bd$3c31c6a0$f14e08c3@arfa>
MIME-Version: 1.0
Importance: Normal
In-Reply-To: <904735570.503897@mars.cs.unp.ac.za>

> Hi there,
>
> I seem to be getting strange results from printf() ...
>
> I'm calling printf() with two arguments like so :
>
> printf("SoundBlaster DSP version %i.%i",sb_dsp_major,sb_dsp_minor);
>
> I have a SB16 DSP ver 4.13 and the line prints out this correctly either,
> after I've run my program at least once since the last reboot, OR if I'm
> debugging (stepping through these exact lines) in RHIDE. If this
> is not the
> case printf() seems to be reversing the variables, ie. I appear to have SB
> DSP ver 13.4 . The variables (sb_dsp_xxxxx) are correct when I
> debug, and so
> I assume they are correct when I don't, so the prob seems to be in the
> printf() function itself.

DJGPP has a 'feature' not occuring in several other compilers, where the
stdout is buffered. Put a \n at the end of the line and it should print when
the statement is executed, not when the buffer is next flushed. You could
also flush the buffer with fflush. It's mentioned in the FAQ, but I can't
remember where.

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