C语言图形高手请进

来源:百度知道 编辑:UC知道 时间:2024/07/02 20:59:27
功 能: 通过检测硬件确定图形驱动程序和模式
老报错:找不到detectgraphic()等标识符

#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

一般我是这样用的,
gdriver=DETECT;
initgraph(&gdriver,&gmode,"");

这样就可以自动检测到你的显示器是啥类型了.

是编译环境的问题,此程序在tc2.0将连接符\取消,放到一行上,是可以编译运行的。
因为<graphics.h> 头文件是tc下的,vc6.0以及devc++4.9.9.2这两个编译环境都不支持。

建议你重新下个tc2.0试试。