Article View: borland.public.cppbuilder.nativeapi
Article #13108Re: Changing Text color
From: Bob Gonder
Date: Mon, 27 Oct 2003 16:44
Date: Mon, 27 Oct 2003 16:44
15 lines
1305 bytes
1305 bytes
Mike King wrote:
>Does anyone know how to change the color of the text in a console
>application?
>
>printf("This is a test");
>setcolor(BLUE);
>printf("This is a test");
>setcolor(RED);
#define color(f, b) ((((f)&0xf)|((b)<<4))&0xff)
void _fastcall set_colors(BYTE f,BYTE b)
{ SetConsoleTextAttribute( stdout, color(f, b) );
}
Technical Details
Message-ID:
<0miqpv4k0fcd28054bd8ehcvp2rohub7fu@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f9d3f26@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,c8cb73d0b2454dea X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-10-27 09:10:42 PST From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Changing Text color Date: Mon, 27 Oct 2003 08:44:26 -0800 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <0miqpv4k0fcd28054bd8ehcvp2rohub7fu@4ax.com> References: <3f9d3f26@newsgroups.borland.com> X-Newsreader: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.31.165.6 X-Trace: newsgroups.borland.com 1067273068 67.31.165.6 (27 Oct 2003 08:44:28 -0700) Lines: 17 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail