TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Ian Petts
from: david nugent
date: 1994-04-10 10:57:40
subject: ANSII Detection

>       Could somebody please show me how I can get a program to detect
 > the presence of an ANSI driver?

#if defined( _MSC_VER )
#define asm __asm
#endif

int
is_ansi (void)
{
    static int hasAnsi = -1;
    if (hasAnsi == -1)
    {
        asm {
           asm mov ax,0x1a00
           asm int 0x2f
           asm cmp al,0xff
           asm mov ax,0
           asm jnz noAnsi
           asm inc ax
          noAnsi:
           hasAnsi = _AX;
        }
    }
    return hasAnsi;
}

Works with DOS 4.0 or above.


 > I'd like to detect if ANSI is available, and if so use escape codes in
 > the printf function to change text colours.

Yep.


 > Also, out of interest, can text colour/flashing etc be used without an
 > ANSI driver? If so, how?

No, not via printf() anyway.


  cheers,
  david

---

* Origin: Unique Computing Pty Ltd (3:632/348)
SEEN-BY: 50/99 54/54 620/243 623/625 632/103 301 348 386 998 633/371 634/384
SEEN-BY: 635/210 502 503 541 544 636/100 670/206 711/409 430 807 808 809 932
SEEN-BY: 711/934 712/623 713/888 714/906 800/1
@PATH: 632/348 635/503 50/99 54/54 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.