delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/02/19:00:36

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Gotoxy() Malfunction
Date: Tue, 02 Jun 1998 18:52:51 -0400
Organization: Two pounds of chaos and a pinch of salt.
Lines: 31
Message-ID: <35748243.4438@cs.com>
References: <3 DOT 0 DOT 1 DOT 32 DOT 19980602143749 DOT 00796100 AT ingtz DOT unizar DOT es>
NNTP-Posting-Host: ppp134.cs.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

KINO wrote:
> 
> I'm starting to write short C programs with the djgpp compiler and i've
> found that gotoxy() function doesn't work well.
> 
> After compiling the source code I execute it and :
> 
> -The cursor's position isn't as I wrote or
> -The cursor's position is O.K. but the printf() function I wrote doesn't
> appear. After quiting the program I press Alt+F5 and what a surprise that
> all sentences wroten (write) appear at the bottom of the screen.

Read chapter 9.4 of the DJGPP Frequently Asked Questions list
(v2/faq210b.zip or online at http://www.delorie.com/djgpp/v2faq/). 
You're attempting to mix stdio functions with conio functions, which is
never guaranteed to work as you intend.  The fact that it may do so
under certain MS-DOS compilers is accidental rather than intentional. 
:-)

In order to make your screen display appear correctly, you should either
substitute stdio output functions for the equivalent conio versions
(printf->cprintf, etc.), or insert fflush(stdout) after every call to
printf(), etc.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I |     mailto:fighteer AT cs DOT com      |
| Proud owner of what might one   |   http://www.cs.com/fighteer/   |
| day be a spectacular MUD...     |       ICQ UIN#:  7406319        |
| Plan: To make Bill Gates suffer |     HEAT User ID:  Fighteer     |
---------------------------------------------------------------------

- Raw text -


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