#include <graphics.h> |
#include <stdlib.h> |
#include <stdio.h> |
#include <conio.h> |
/* names of the various cards supported */ |
char *dname[] = { "requests detection" , |
"a CGA" , |
"an MCGA" , |
"an EGA" , |
"a 64K EGA" , |
"a monochrome EGA" , |
"an IBM 8514" , |
"a Hercules monochrome" , |
"an AT&T 6300 PC" , |
"a VGA" , |
"an IBM 3270 PC" |
}; |
int main ( void ) |
{ |
/* returns detected hardware info. */ |
int gdriver, gmode, errorcode; |
/* detect graphics hardware available */ |
detectgraph ( &gdriver, &gmode ); |
/* read result of detectgraph call */ |
errorcode = graphresult(); |
if ( errorcode != grOk ) /* an error |
occurred */ |
{ |
printf ( "Graphics error: %s\n" , \ |
grapherrormsg ( errorcode ) ); |
printf ( "Press any key to halt:" ); |
getch(); |
exit ( 1 ); /* terminate with an error |
code */ |
} |
/* display the information detected */ |
clrscr(); |
printf ( "You have %s video display \ |
card.\n", dname[gdriver] ); |
printf ( "Press any key to halt:" ); |
getch(); |
return 0; |
} |