closegraph

Overview :

The "closegraph" function is used exit the graphics mode and return back to the text mode
This function deallocate all the memory allocated by the graphics system.
This function clears the memory by giving call to _graphfreemem

Syntax :
void closegraph()
Description :
The "closegraph" function has no parameters
  • The function can be called in grahics mode.

  • The function doesn't return any value

  • The function exits the graphics mode and put back you in text mode


Example :
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main()
{
    
   int gm,gd=DETECT;
   
   printf("\nEnter any key to go in graphics mode");
   getch();
      
   initgraph(&gd,&gm,"C:\\turboc3\\bgi");
   setcolor(10);
   
   outtextxy(100,100,"You are in graphics mode.Press any key to return back");
   getch();
   
   closegraph();
   
   printf("\nYou have entered again in text mode");
   
   getch();
   
   return 0;
}

Comments

comments powered by Disqus