delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/06/14:51:14

Date: Mon, 6 Dec 1999 17:47:11 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Jude Dashiell <jdashiel AT clark DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: using ansi.sys syntax question
In-Reply-To: <2RM24.45715$oa2.363278@iad-read.news.verio.net>
Message-ID: <Pine.SUN.3.91.991206173745.21836B-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 6 Dec 1999, Jude Dashiell wrote:

> row=2;
> col=30;
> printf('\33''\133'row,col'\150'"natal change locator");
> in as one of the lines in this program.

Note: this will only work if you have ANSI.SYS installed on your 
machine.  Otherwise, the escape sequences will be written to the screen 
verbatim.

> I'll probably have to substitute:
> *row and *col to get the contents of row and col to write out, and
> probably
> the octal for the comma character.  Is that likely to be all of the syntax
> that's messed up in this line?

No, you will need to use printf format specifiers, like this (untested!):

  printf ("\033[%2.2d;%2.2dH", row, col);

Again, this will only work if ANSI.SYS is installed.

> I'm curious if djgpp offers any other way to do this at some higher level
> of abstraction too.
> Other packages like ansisys-c.zip on the simtel archives have existed
> since 1995 so this has me wondering about djgpp and maybe something I've missed
> reading those info files.

Those packages only make sense if you have a large body of existing code 
that already uses ANSI escape sequences, and you want to make it work on 
a DOS terminal without changing the original code too much.

But in your case, I understand that you write the bulk of the code 
yourself.  So you could simply use gotoxy and printf (plus fflush!) to 
achieve the same effect without any complications.

- Raw text -


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