www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/13/05:20:26

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Date: Wed, 13 Feb 2002 12:18:02 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Warren Simmons <wlsimmons AT worldnet DOT att DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: ansi escape codes do not work using DJGPP gpp command
In-Reply-To: <000801c1b447$16bf5480$b95b560c@ws1>
Message-ID: <Pine.SUN.3.91.1020213121311.15678F-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 12 Feb 2002, Warren Simmons wrote:

> This is a post for the djgpp forum or a question that perhaps one of you =
> could answer.
> I use the ansi escape codes for various screen functions. To clear the =
> screen I #include <stdio.h> and include the line:  printf("\33[2J"); =
> wherever I want the screen to clear. It works on GNU g++ (Linux) but =
> when I use it with DJGPP (gpp -Wall somefile.cpp) the outpu of the .exe =
> at that point will print to the screen the following:  --[2Jthen the =
> cout from the next line.

The ANSI escape sequences are implemented by the terminal device driver.  
Unix and GNU/Linux systems have that enabled by default, while MS-DOS 
terminal by default doesn't support that.  You should be able to turn on
support for that by loading the ANSI.SYS device driver.  However, I'm not 
sure this will work inside the Windows DOS box.

In general, use of such escape sequences is inherently non-portable.  You 
should not expect it to work on every system.

> I use this to clear =
> the screen. I have a locate x,y function the uses ansi escape code. Its =
> very useful.

If you don't want to load ANSI.SYS, you could replace that code with 
calls to conio functions such as clearscr or ScreenClear.

> Also...can djgpp print out the acsii extended character set =
> (128 to 256 symbols)?

Yes.  But keep in mind that the font used by MS-DOS and MS-Windows for 
these codes is different from what Unix and GNU/Linux systems use.  So 
don't expect to see the same glyphs on the screen in every case.

- Raw text -


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