Q:

grapherrormsg function in C using graphics.h

0

grapherrormsg function in C using graphics.h

grapherrormsg function returns an error message string.

Declaration: char *grapherrormsg( int errorcode );

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

main()
{
   int gd, gm, errorcode;

   initgraph(&gd, &gm, "C:\\TC\\BGI");

   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;
}

In the above program we have not written gd = DETECT.
After running this program we get the output :-
Graphics error: Graphics hardware not detected
Press any key to exit.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now