Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>graphresult() return graphics system error code</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 graphresult()           Return Graphics System Error Code

 #include   <graphics.h>

 int far    graphresult(void);

    graphresult() retrieves the internal error code that is set after an
    unsuccessful graphics function call.  The error codes are defined as
    follows, (along with the error message strings returned by
    grapherrormsg()):

        Error      'graphics_errors'
        code           constant              Error message string

      0             grOk                No error
     -1             grNoInitGraph       Graphics not installed
     -2             grNotDetected       Graphics hardware not detected
     -3             grFileNotFound      Device driver not found
     -4             grInvalidDriver     Invalid device driver file
     -5             grNoLoadMem         Insufficient memory to load driver
     -6             grNoScanMem         Out of memory in scan fill
     -7             grNoFloodMem        Out of memory in flood fill
     -8             grFontNotFound      Font file not found
     -9             grNoFontMem         Not enough memory to load font
     -10            grInvalidMode       Invalid mode for selected driver
     -11            grError             Graphics error
     -12            grIOerror           Graphics I/O error
     -13            grInvalidFont       Invalid font file
     -14            grInvalidFontNum    Invalid font number
     -15            grInvalidDeviceNum  Invalid device number

    Because graphresult() resets the error code to 0 after it has been
    called, its value should be stored in a temporary variable and then
    tested.

    Returns:    The current graphics error number which range from -15 to
                0.

   -------------------------------- Example ---------------------------------

    The following statements initialize the graphics system and print an
    error message on error.

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

           int gdriver = DETECT;
           int gmode;
           int errslt;

           main()
           {
               initgraph(&gdriver,&gmode,"");
               errslt = graphresult();
               if (errslt < 0 )
                  printf("Error #%d, %s\n",errslt,grapherrormsg(errslt));
               getch();
               .
               .
               /* graphics operations */
               .
               .
               closegraph();
           }


See Also: grapherrormsg()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson