读书人

各位好 小弟我第一次来这里

发布时间: 2012-09-29 10:30:01 作者: rapoo

各位好 我第一次来这里求助
在下被"bgi error:graphics not intialized <use 'initgraph'>"困了,不管如此捣鼓还是还没解决好,代码是这样:
#include<graphics.h>
void main()
{
int driver,mode;
driver=DETECT;
registerbgigriver(EGAVGA_driver);
initgraph(&driver,&mode,"E:\\TC");
bar3d(260,180,360,240,20,1);
getch();
restorecrtmode();
}
大家可有好解决办法,在下先谢过,顺便给各位请安



[解决办法]
initgraph(&driver,&mode,"E:\\TC");
错误,无法初始化。检查该函数。
[解决办法]
函数名: 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());
  
/* clean up */   
getch();   

closegraph();   

return 0;   
}

读书人网 >C语言

热点推荐