home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD2.mdf
/
c
/
library
/
mslang
/
cp1
/
blinkoff.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-10
|
2KB
|
81 lines
===========================================================================
BBS: The Abacus * HST/DS * Potterville MI
Date: 06-06-93 (19:18) Number: 162
From: SID ROGERS Refer#: 163
To: TONY CALDARONE Recvd: NO
Subj: Changing Colours In C Conf: (36) C Language
---------------------------------------------------------------------------
On 06-03-93 TONY CALDARONE wrote to ALL...
TC> How do you change the text colour in C? (foreground and background)
TC> ... also set blinking characters on or off in C? Thanks for the help!
Tony,
This should help ......
#include <dos.h>
#include <conio.h>
void blinkoff(void)
{
union REGS in, out;
in.h.ah = 0x10;
in.h.al = 0x03;
in.h.bl = 0x00;
int86(0x10,&in,&out);
}
void blinkon(void)
{
union REGS in, out;
in.h.ah = 0x10;
in.h.al = 0x03;
in.h.bl = 0x01;
int86(0x10,&in,&out);
}
int color(int fore, int back) /* similar to a BASIC call */
{
int temp;
/* bounds check here if desired */
temp = (16*back)+fore;
if(fore > 15) temp = temp+112;
return temp;
}
#define STD_COLOR color(14,1)
main()
{
register int row, col;
int cur_color = 0;
textattr(STD_COLOR);
clrscr();
window(20,4,36,21);
blinkon();
for(row = 0; row <=15;row++)
for(col = 0;col<=15;col++)
{
gotoxy(col+1,row+1);
cur_color = color(row,col);
textattr(cur_color);
cprintf("*");
}
textattr(STD_COLOR);
cprintf("\r\nHit a key");
getch();
blinkoff();
getch();
blinkon();
window(1,1,25,80);
return 0;
}
=== Sid ===
... OFFLINE 1.39 * From here to nowhere..an eternity
---
* Origin: Fire Fly BBS (508)356-2469 Ipswich, MA USA (1:330/173)
SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20