Header file:
graphics.h
Synopsis:
void detectgraph (int *graphicdriver, int *graphmode);
Description:
detectgraph() checks the system's graphic adapter and find the graphic driver & gaphic mode to use. Below are the various available drivers.
enum graphic_driver {
DETECT = 0, // auto detection
CGA, MCGA, EGA,
EGA64, EGAMONO, IBM8514,
HERCMONO, ATT400, VGA, PC3270
}
enum graphic_driver {
DETECT = 0, // auto detection
CGA, MCGA, EGA,
EGA64, EGAMONO, IBM8514,
HERCMONO, ATT400, VGA, PC3270
}
detectgraph function in c graphics
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void) {
/* returns detected hardware info. */
int graphicDriver, graphicMode;
int err;
clrscr();
/* detect graphics hardware available */
detectgraph(&graphicDriver, &graphicMode);
/* read result of detectgraph call */
err = graphresult();
if (err != grOk) {
/* an error occurred */
printf("Graphic Error: %s\n",
grapherrormsg(err));
return 0;
}
printf("BGI Graphic Driver => ");
switch(graphicDriver) {
case 0:
printf("DETECT(request autodetect)!!\n");
break;
case 1:
printf("CGA\n");
break;
case 2:
printf("MCGA\n");
break;
case 3:
printf("EGA\n");
break;
case 4:
printf("64K EGA\n");
break;
case 5:
printf("Monochrome EGA\n");
break;
case 6:
printf("IBM 8514\n");
break;
case 7:
printf("Hercules Monochrome\n");
break;
case 8:
printf("AT & T 6300 PC\n");
break;
case 9:
printf("VGA\n");
break;
case 10:
printf("IBM 3270 PC\n");
break;
default:
printf("Error!!\n");
break;
}
printf("Press Any Key To Exit:");
getch();
return 0;
}
Output: (detectgraph built-in function in c graphics.h)
No comments:
Post a Comment