• Have Any Question?
  • contact@eitworld.com

Graphresult() Function





graphresult() function returns the error code for any failed graphics operation and that error code is accepted by the grapherrormsg() function. If not any graphic operations fails then it returns grOk.

Declaration

int graphresult();
  • graphresult returns the current graphics error number or code, an integer in the range -15 to 0. There are various errorcode present in the enumerated form in graphic.h header file as shown here:
  • For better understanding go through the program:

Program

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT, gm,errorcode;

char a[50];

initgraph(&gd,&gm,” “);

errorcode=graphresult();

if(errorcode!=grOk)

{

sprintf(a,”Graphics error:%s:,(grapherrormsg(errorcode)));

outtexttexy(100,240,a);

getch();

return 0;

}

circle(320,240,100);

getch();

closegraph();

}

Above program will display an error message if there will any error. To get an error, delete the *.BGI file in your local folder or remove BGI directory from your path settings: Then you will get the error string: Graphics error:device drive file not fornd (EGAVGA.BGI). If there is no error then it will display a circle of 100 cm radius at position(320,240) as given below:

Output

c graphics



Real Time Web Analytics