RAD Studio
ContentsIndex
PreviousUpNext
textbackground

Header File 

conio.h  

Category 

Console I/O Routines 

Prototype 

void textbackground(int newcolor); 

Description 

Selects new text background color.

Note: Do not use this function in Win32 GUI applications.
textbackground selects the background color. This function works for functions that produce output in text mode directly to the screen. newcolor selects the new background color. You can set newcolor to an integer from 0 to 7, or to one of the symbolic constants defined in conio.h. If you use symbolic constants, you must include conio.h. 

Once you have called textbackground, all subsequent functions using direct video output (such as cprintf) will use newcolor. textbackground does not affect any characters currently onscreen. 

The following table lists the symbolic constants and the numeric values of the allowable colors:

BLACK 
BLUE 
GREEN 
CYAN 
RED 
MAGENTA 
BROWN 
LIGHTGRAY 

Return Value 

None. 

Example  

#include <conio.h>
int main(void)
{
   int i, j;
   clrscr();
   for (i=0; i<9; i++)
   {
       for (j=0; j<80; j++)
          cprintf("C");
       cprintf("\r\n");
       textcolor(i+1);
       textbackground(i);
   }
   return 0;
}

Portability

POSIX 
Win32 
ANSI C 
ANSI C++ 
 
 
 
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!