Date: Thu, 4 Dec 1997 17:24:54 -0800 (PST) Message-Id: <199712050124.RAA26239@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: Vic , djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: printf in graphic mode?? Precedence: bulk At 07:18 12/3/1997 -0500, Vic wrote: >Hi. I was messing with my program and I got this weird thing... >I'm using the Allegro lib and, while in graphics mode, after invoking >several times a compiling function, my whole screen shifter a bit to the >left and down. I initially thought I had found a bug in my project. >Untill I realised this was caused by a printf function that was called.. >So I wonder: what is it that printf does that messes up the graphics >screen? The same thing it does in text mode, only with different effects. It writes it to the stdout device. If the stdout device is the console (you aren't redirecting), DOS tries to write it to the screen, blissfully unaware that the hardware is in graphics mode. Weird stuff results. The fix: Don't do that. :) If you want your stuff to go to a file, use `fprintf'. If you want it to go to the screen, and work, use `sprintf' and `text_out' the resulting string. (I think Allegro 3.0 has a function to do this automatically...) Nate Eldredge eldredge AT ap DOT net