cleardevice() function in C
Last Updated :
23 Jan, 2018
The header file graphics.h contains cleardevice() function which clears the screen in graphics mode and sets the current position to (0,0). Clearing the screen consists of filling the screen with current background color.
Syntax :
void cleardevice();
Below is the implementation of cleardevice() in C:
#include <graphics.h>
int main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "" );
setbkcolor(GREEN);
outtext( "Press any key to clear the screen." );
getch();
cleardevice();
outtext( "Press any key to exit..." );
getch();
closegraph();
return 0;
}
|
Output:
On executing the program, the output window looks like :
On pressing any key :
To exit, press any key.
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...