User Tools

Site Tools


c:graphics.h:closegraph

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:graphics.h:closegraph [2024/02/16 01:05] (current)
Line 1: Line 1:
 +===== closegraph =====
 +
 +
 +====Syntax of closegraph ==== 
 + <code c>
 +#include <graphics.h>
 +void closegraph(int wid=ALL_WINDOWS);
 +  </code>
 +
 +
 +==== Description of closegraph ==== 
 +<code c>
 +closegraph deallocates all memory allocated by the graphics system, then
 +restores the screen to the mode it was in before you called initgraph.
 +(The graphics system deallocates memory, such as the drivers, fonts, and
 +an internal buffer, through a call to _graphfreemem.)
 +</code>
 +
 +
 +==== Example of closegraph ====
 +<code c>
 +/* closegraph example */
 +
 +#include <graphics.h>
 +#include <stdlib.h>
 +#include <stdio.h>
 +#include <conio.h>
 +
 +int main(void)
 +{
 +   /* request autodetection */
 +   int gdriver = DETECT, gmode, errorcode, x, y;
 +
 +   /* initialize graphics mode */
 +   initgraph(&gdriver, &gmode, "");
 +
 +   /* read result of initialization */
 +   errorcode = graphresult();
 +
 +   if (errorcode != grOk) {   /* an error occurred */
 +printf("Graphics error: %s\n", grapherrormsg(errorcode));
 +printf("Press any key to halt:");
 +
 +getch();
 +exit(1);   /* terminate with an error code */
 +}
 +
 +   x = getmaxx() / 2;
 +   y = getmaxy() / 2;
 +
 +   /* output a message */
 +   settextjustify(CENTER_TEXT, CENTER_TEXT);
 +   outtextxy(x, y, "Press a key to close the graphics system:");
 +
 +   getch();   /* wait for a key */
 +   /* closes down the graphics system */
 +   closegraph();
 +   printf("We're now back in text mode.\n");
 +   printf("Press any key to halt:");
 +   getch();
 +   return 0;
 +
 +}
 +</code>
 +
 +
 +==== See also ====
 +[[initgraph]]
 +[[initwindow]]
 +[[setgraphbufsize]]
 +[[setcurrentwindow]]
 +
 +
 +===== output of closegraph example ===== 
 +
 +    no output of example at the moment
 +    do not hesitate and add it...  
 +
 +
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/graphics.h/closegraph.txt · Last modified: 2024/02/16 01:05 (external edit)

Impressum Datenschutz