delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/11/04:15:50

From: pneyz <pneyz AT bethany DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Setting text colors
Date: Wed, 10 Dec 1997 18:16:55 -0800
Organization: Smoof Team
Lines: 21
Message-ID: <348F4D16.9AD9ACC6@bethany.edu>
References: <66ncde$6rr AT bgtnsc02 DOT worldnet DOT att DOT net>
NNTP-Posting-Host: scz-ca17-04.ix.netcom.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>    How do you set different text colors in DJGPP? If a particular header
> file is necessary, which is it?

In conio.h, there is a function called textattr(int) that will do what
you want. It's even simpler to use textcolor(int) and
textbackground(int) as they are more user-friendly subfuctions (bad
description) of textattr.

// the following code will change the text to bright white on blue

#include <conio.h>

void main (void)
{
 textcolor(15);
 textbackground(1);
}

-- 
                                       pneyz[smoof.ganja]
                                       "Fine Malt Coding"

- Raw text -


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