getbkcolor() function

getbkcolor function returns the current background color.

Declaration of getbkcolor() function

int getbkcolor();

e.g. color = getbkcolor(); // color is an int variable

if current background color is GREEN then color will be 2.

C program for getbkcolor()

#include<graphics.h> 
#include<conio.h>
main()
{
int gd = DETECT, gm, bkcolor; 
char a[100];
initgraph(&gd,&gm,"C:\\ TurboC3\\BGI"); 
bkcolor = getbkcolor();
sprintf(a,"Current background color = %d", bkcolor); outtextxy( 10, 10, a);
getch(); 
closegraph(); 
return 0;
}