grapherrormsg() function in C
Last Updated :
23 Jan, 2018
The header file graphics.h contains grapherrormsg() function which returns an error message string.
Syntax :
char *grapherrormsg( int errorcode );
where,
errorcode: code for the respective error
Illustration of the grapherrormsg() : In the below program, gd = DETECT is not written and thus program must throw an error.
Below is the implementation of grapherrormsg() function in C
#include <graphics.h>
#include <stdio.h>
int main()
{
int gd, gm, errorcode;
initgraph(&gd, &gm, "" );
errorcode = graphresult();
if ( errorcode != grOk)
{
printf ( "Graphics error: %s\n" ,
grapherrormsg(errorcode));
printf ( "Press any key to exit." );
getch();
exit (1);
}
getch();
closegraph();
return 0;
}
|
Output :
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...