Returns the status of the most recent graphics function call.
#include <graph.h>
short __far _grstatus( void );
The _grstatus function returns the status of the most recently used graphics function. The _grstatus function can be used immediately following a call to a graphics routine to determine if errors or warnings were generated. Return values less than 0 are errors, and values greater than 0 are warnings.
The following manifest constants are defined in the GRAPH.H header file for use with the _grstatus function:
Value | Constant | Meaning |
0 | _GROK | Success. |
–1 | _GRERROR | Graphics error. |
–2 | _GRMODENOTSUPPORTED | Requested video mode not supported. |
–3 | _GRNOTINPROPERMODE | Requested routine only works in certain video modes. |
–4 | _GRINVALIDPARAMETER | One or more parameters invalid. |
–5 | _GRFONTFILENOTFOUND | No matching font file found. |
–6 | _GRINVALIDFONTFILE | One or more font files invalid. |
–7 | _GRCORRUPTEDFONTFILE | One or more font files inconsistent. |
–8 | _GRINSUFFICIENTMEMORY | Not enough memory to allocate buffer or to complete a _floodfill operation. |
–9 | _GRINVALIDIMAGEBUFFER | Image buffer data inconsistent. |
1 | _GRNOOUTPUT | Nothing drawn. |
2 | _GRCLIPPED | Output was clipped to viewport. |
3 | _GRPARAMETERALTERED | One or more input parameters was altered to be within range, or pairs of parameters were interchanged to be in the proper order. |
After a graphics call, use an if statement to compare the return value of _grstatus to _GROK. For example:
if( _grstatus < _GROK )
/*handle graphics error*/ ;
The functions listed below cannot cause errors, and they all set _grstatus to _GROK:
_displaycursor_gettextposition_outmem_getactivepage_gettextwindow _outtext_getbkcolor _getvideoconfig _unregisterfonts_getgtextvector_getvisualpage _wrapon_gettextcolor _displaycursor_getactivepage_getbkcolor_getgtextvector_gettextcolor_gettextposition_gettextwindow_getvideoconfig_getvisualpage_outmem_outtext_unregisterfonts_wrapon
See the list below for the graphics functions that affect _grstatus. The list shows error or warning messages that can be set by the graphics function. In addition to the error codes listed, any of these functions can produce the _GRERROR error code.
FunctionG |
Possible _grstatus Error Codes |
Possible _grstatus Warning Codes |
_arc functions | _GRNOTINPROPERMODE, _GRINVALIDPARAMETER | _GRNOOUTPUT, _GRCLIPPED | |
_clearscreen | _GRNOTINPROPERMODE, _GRINVALIDPARAMETER, | ||
_ellipse functions | _GRNOTINPROPERMODE, _GRINVALIDPARAMETER, _GRINSUFFICIENTMEMORY | _GRNOOUTPUT, _GRCLIPPED | |
_floodfill functions | _GRNOTINPROPERMODE, _GRINVALIDPARAMETER, _GRINSUFFICIENTMEMORY | _GRNOOUTPUT | |
_getarcinfo | _GRNOTINPROPERMODE, | ||
_getcurrentposition functions | _GRNOTINPROPERMODE, | ||
_getfontinfo | ( _GRERROR only), | ||
_getgtextextent | ( _GRERROR only), | ||
_getgtextvector | _GRPARAMETERALTERED, | ||
_getimage functions | _GRNOTINPROPERMODE | _GRPARAMETERALTERED | |
_getphyscoord | _GRNOTINPROPERMODE, | ||
_getpixel functions | _GRNOTINPROPERMODE, | ||
_gettextcursor | _GRNOTINPROPERMODE, | ||
_getviewcoord functions | _GRNOTINPROPERMODE, | ||
_getwindowcoord | _GRNOTINPROPERMODE, | ||
_getwritemode | _GRNOTINPROPERMODE, | ||
_imagesize functions | _GRNOTINPROPERMODE, | ||
_lineto functions | _GRNOTINPROPERMODE | _GRNOOUTPUT, _GRCLIPPED | |
_moveto functions | _GRNOTINPROPERMODE, | ||
_outgtext | _GRNOTINPROPERMODE | _GRCLIPPED, _GRNOOUTPUT | |
_pie functions | _GRNOTINPROPERMODE, _GRINVALIDPARAMETER, _GRINSUFFICIENTMEMORY | _GRNOOUTPUT, _GRCLIPPED | |
_polygon functions | _GRNOTINPROPERMODE, _GRINVALIDPARAMETER, _GRINSUFFICIENTMEMORY | _GRNOOUTPUT, _GRCLIPPED | |
_putimage functions | _GRERROR, _GRNOTINPROPERMODE, _GRINVALIDPARAMETER, _GRINVALIDIMAGEBUFFER | _GRPARAMETERALTERED, _GRNOOUTPUT | |
_rectangle functions | _GRNOTINPROPERMODE, _GRINVALIDPARAMETER, _GRINSUFFICIENTMEMORY | _GRNOOUTPUT, _GRCLIPPED | |
_registerfonts | _GRCORRUPTEDFONTFILE, _GRFONTFILENOTFOUND, _GRINSUFFICIENTMEMORY, _GRINVALIDFONTFILE, | ||
_remappalette | _GRERROR, _GRINVALIDPARAMETER, | ||
_remapallpalette | _GRERROR, _GRINVALIDPARAMETER, | ||
_scrolltextwindow | _GRNOOUTPUT | ||
_selectpalette | _GRNOTINPROPERMODE, _GRINVALIDPARAMETER, | ||
_setactivepage | _GRINVALIDPARAMETER, | ||
_setbkcolor | _GRINVALIDPARAMETER | _GRPARAMETERALTERED | |
_setcliprgn | _GRNOTINPROPERMODE | _GRPARAMETERALTERED | |
_setcolor | _GRNOTINPROPERMODE | _GRPARAMETERALTERED | |
_setfont | _GRERROR, _GRFONTFILENOTFOUND, _GRINSUFFICIENTMEMORY, _GRPARAMETERALTERED | ||
_setgtextvector | _GRPARAMETERALTERED, | ||
_setpixel | _GRNOTINPROPERMODE | _GRNOOUTPUT | |
_settextcolor | _GRPARAMETERALTERED | ||
_settextcursor | _GRNOTINPROPERMODE, | ||
_settextposition | _GRPARAMETERALTERED | ||
_settextrows | _GRINVALIDPARAMETER | _GRPARAMETERALTERED | |
_settextwindow | _GRPARAMETERALTERED | ||
_setvideomode | _GRERROR, _GRMODENOTSUPPORTED, _GRINVALIDPARAMETER, | ||
_setvideomoderows | _GRERROR, _GRMODENOTSUPPORTED, _GRINVALIDPARAMETER, | ||
_setvieworg | _GRNOTINPROPERMODE, | ||
_setviewport | _GRNOTINPROPERMODE | _GRPARAMETERALTERED | |
_setvisualpage | _GRINVALIDPARAMETER, | ||
_setwindow | _GRNOTINPROPERMODE, _GRINVALIDPARAMETER | _GRPARAMETERALTERED | |
_setwritemode | _GRNOTINPROPERMODE, _GRINVALIDPARAMETER, |
The _grstatus function returns the status of the most recently used graphics function.
_arc functions, _ellipse functions, _floodfill functions, _lineto functions, _pie functions, _remapallpalette, _setactivepage, _setbkcolor, _setcolor, _setpixel functions, _settextcolor, _settextcursor, _setvisualpage, _setwindow, _setwritemode
Standards:None
16-Bit:DOS
32-Bit:None