Header file:
graphics.h
Synopsis:
int getmaxmode (void);
Description:
getmaxmode() returns maximum available video mode value for the current graphic driver.
getmaxmode function in c graphics
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void) {
/* request auto detection */
int graphicDriver = DETECT, graphicMode;
int err, midx, midy;
char graphicMaxMode[80];
/* initialize graphics and local variables */
initgraph(&graphicDriver, &graphicMode, "C:/TURBOC3/BGI");
/* read result of initialization */
err = graphresult();
if (err != grOk) {
/* an error occurred */
printf("Graphic Error: %s\n",
grapherrormsg(err));
return 0;
}
/* mid position in x and y-axis */
midx = getmaxx() / 2;
midy = getmaxy() / 2;
/* store max graph mode value in a string */
sprintf(graphicMaxMode, "Maximum graphic mode for "
"current driver is %d", getmaxmode());
/* display the information */
outtextxy(midx - 200, midy, graphicMaxMode);
/* clean up */
getch();
closegraph();
return 0;
}
Output: (getmaxmode built-in function in c graphics.h)
No comments:
Post a Comment