在tc编程中,initgraph(&graphdriver,&graphmode,\"\");

来源:百度知道 编辑:UC知道 时间:2024/06/04 05:17:08
这个函数的参数应当要怎么设置啊

initgraph 函数名: initgraph()
功 能: 初始化图形系统
函数原型: void far initgraph(int far *graphdriver, int far *graphmode,
char far *pathtodriver);graphdriver是上涨指向图形驱动序号变量的指针;graphmode是在graphdriver选定后,指向图形显示模式序号变量的指针。pathtodriver表示存放图形驱动文件的路径。
头文件:graphics.h
程序例:
#include "graphics.h"
#include "stdio.h"
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* return with error code */
}
/* draw a line */
line(0, 0, getmaxx(), getmaxy());