User Tools

Site Tools


Programming Reference/Librarys

Question & Answer

Q&A is closed

to support this page (eg 0,42 € or so) Thanks.


Syntax of graphresult

#include <graphics.h>
int graphresult(void);

Description of graphresult

graphresult returns the error code for the last graphics operation that
reported an error and resets the error level to grOk.
The following table lists the error codes returned by graphresult. The
enumerated type graph_errors defines the errors in this table.
graph_errors is declared in graphics.h.
code  constant     Corresponding error message string
0 grOk   No error
-1grNoInitGraph(BGI) graphics not installed (use initgraph)
-2grNotDetectedGraphics hardware not detected
-3grFileNotFound     Device driver file not found
-4grInvalidDriver    Invalid device driver file
-5grNoLoadMem  Not enough memory to load driver
-6grNoScanMem  Out of memory in scan fill
-7grNoFloodMem Out of memory in flood fill
-8grFontNotFound  Font file not found
-9grNoFontMem  Not enough memory to load font
-10     grInvalidModeInvalid graphics mode for selected driver
-11     grErrorGraphics error
-12     grIOerror    Graphics I/O error
-13     grInvalidFontInvalid font file
-14     grInvalidFontNum   Invalid font number
-15     grInvalidDeviceNum Invalid device number
-18     grInvalidVersion   Invalid version number
Note: The variable maintained by graphresult is reset to 0 after
graphresult has been called. Therefore, you should store the value of
graphresult into a temporary variable and then test it.

Example of graphresult

/* graphresult example */
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
   /* request autodetection */
   int gdriver = DETECT, gmode, errorcode;
   /* initialize graphics and local variables */
   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:");
exit(1);   /* terminate with an error code */
   /* draw a line */
   line(0, 0, getmaxx(), getmaxy());
   /* clean up */
   return 0;

See also

output of graphresult example

  no output of example at the moment
  do not hesitate and add it...  
c/graphics.h/graphresult.txt · Last modified: 2015/05/06 23:06 (external edit)