You are here

Cleardevice function in c

Declaration: void cleardevice();
cleardevice function 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.

C program for cleardevice

#include <graphics.h>
#include <conio.h>

   int gd = DETECT, gm;
   initgraph(&gd, &gm, "C:\\TC\\BGI");

   outtext("Press any key to clear the screen.");
   outtext("Press any key to exit...");
   return 0;

Note : Don't use clrscr in graphics mode.