Mail Archives: djgpp/1996/04/24/02:04:07
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 -