Header file:
graphics.h
Synopsis:
char * grapherrormsg(int errorno);
errorno - error code returned by graphresult()
Description:
grapherrormsg() returns a pointer to string containing error message.
grapherrormsg function in c graphics
#include <conio.h>
#include <graphics.h>
#include <dos.h>
int main() {
/* request auto detection */
int graphicDriver = DETECT, graphicMode;
int err, midx, midy;
int circleRadius = 150;
/* initialize graphics system */
initgraph(&graphicDriver, &graphicMode,
"C:/TURBOC3/BGI");
err = graphresult();
if (err != grOk) {
/* error occurred */
printf("Graphic Error: %s\n",
grapherrormsg(err));
return 0;
}
/* mid position x and y-axis */
midx = getmaxx() / 2;
midy = getmaxy() / 2;
/* sets the current drawing color and fill style */
setcolor(GREEN);
setfillstyle(SOLID_FILL, GREEN);
/* draws a circle at the center of the graphic screen */
circle(midx, midy, circleRadius);
/* fill the bounded area using the given fill color */
floodfill(midx, midy, GREEN);
/* clean up */
getch();
closegraph();
return 0;
}
Output: (grapherrormsg built-in function in c graphics.h)
No comments:
Post a Comment