www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/12/02:47:36

Date: Thu, 12 Nov 1998 09:47:11 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Doug Scott <dscott AT chernikeeff DOT co DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: gcc v281 bug?
In-Reply-To: <3649ECBC.794BDF32@chernikeeff.co.uk>
Message-ID: <Pine.SUN.3.91.981112094117.10313P-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Wed, 11 Nov 1998, Doug Scott wrote:

> The output is:
> Qaaazzz
> 
> I would expect the output to be:
> aaaQzzz

Your expectations are wrong.  `putch' uses direct screen writes to the
video memory of your SVGA, whereas `printf' buffers its output and 
doesn't actually deliver it to the screen until the buffer is flushed.  
(In your cases, it is flushed when your program exits.)

The DJGPP FAQ list (v2/faq211b.zip from the same place you get DJGPP) 
explains that it is usually a bad idea to mix buffered I/O with direct 
screen writes.  See section 9.4 of the FAQ.

> 	test1 > out
> 
> The character Q goes to the screen and the rest to the file.
> I cannot recall  if putch() is "supposed to" use stdout or not and I
> have mentioned this here just in case it is.

`putch' writes characters directly to the video memory.

> I do not read the mail list but it would be nice to know if the bug is
> in my analysis or in the compiler/library. 

This is no bug, it's how things should work.

- Raw text -


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