home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!jvnc.net!primerd.prime.com!shovel!tim
- From: tim@shovel.Prime.COM (Tim Cantin)
- Subject: Re: Using ANSI.SYS codes from C? (Turbo)
- Message-ID: <1992Aug18.111356@shovel.Prime.COM>
- Followup-To: comp.lang.c
- Keywords: ansi.sys
- Sender: tim@shovel (Tim Cantin)
- Organization: Prime Computer R&D
- References: <1992Aug18.013912.12547@cs.umb.edu>
- Date: Tue, 18 Aug 1992 15:13:56 GMT
- Lines: 63
-
- In article <1992Aug18.013912.12547@cs.umb.edu>, cteague@ra.cs.umb.edu (Charles F. Teague II) writes:
-
- > Is there any way to use ANSI.SYS escape sequences from C?
-
- In article <josef.714123379@uranium>, josef@nixpbe.sni.de (Moellers) writes:
-
- > I've never tried this, but something like
- > printf("\033[3mText\033[0m");
- > should do something to Your "Text".
-
- Charles, Josef hit it right on the head. The only catches are that you MUST
- have ansi.sys loaded in your \config.sys file, and you cannot use conio.h
- functions with ANSI codes. When you send ANSI codes through cprintf() they are
- printed literally.
-
- Here are some codes off the top of my head: (I know you didn't ask for them,
- but someone else might want to know) (btw, 'esc' below is hex33, the ESC char.)
-
- ANSI output
- code results
- ---- -------
- esc[0m normal (no attributes, default)
- esc[1m high intensity (the default for some, i.e. Prime terminals)
- esc[2m low intensity (in some environments, i.e. Prime terminals)
- esc[4m underlined
- esc[5m blinking
- esc[7m reverse
-
- esc[r;cH position cursor to r,c
- esc[2J clear screen (may differ for some terminals, Prime PT200 is esc?)
-
- esc[xm set color x where colors are:
- foreground: background:
- 30 black 40 black
- 31 41
- 32 42
- 33 43
- 34 44
- 35 45
- 36 46
- 37 47
- 38 48
- 39 49
-
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^___darn, I can't remember them!
- it's the same as the resistor
- code table if you know that! :)~
-
- You can also combine 'm' attributes by seperating them with a semi-colon:
-
- printf("\033[4;5m***This is underlined and blinking***\033[0m\n");
-
- Have fun!
- -Tim
-
- p.s.
- If anyone knows those color codes, feel free to post them! *grin*
-
- --
- #include "stddisclaimer.h"
- /* Tim Cantin {uunet, csnet-relay}!primerd!tim || tim@s35.prime.com
- Prime Computer Inc. 10-21, 500 Old Conn. Path, Framingham, MA 01701 (USA) */
- flames > /dev/null 2>&1
-