home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12482 < prev    next >
Encoding:
Text File  |  1992-08-18  |  2.3 KB  |  77 lines

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