一个关于 turbo c 的绘图问题

Ghoststears 2008-10-21 05:45:52
一直都在搞 C++ ,突然搞个 C 的绘图程序,用 TC 2.0 提供的绘图库,测试进入绘图模式,一直失败,不知道是怎么回事。请大家帮我看看。测试代码:


#include <graphics.h>
#include <stdio.h>
#include <conio.h>


main()
{
int gmode = -1;
int gdriver = -1;
int init_result = -1;

initgraph( &gmode, &gdriver, "d:\\bgi" );

init_result = graphresult();
if (grOk != init_result)
{
printf("init error, the error code is: %d", init_result);
getch();
return -1;
}
else
{
printf( "graph init OK.\n" );
printf( "graph driver is: %d, graph mode is: %d\n", gdriver, gmode);
}

getch();
return 0;
}


运行结果:
init error, the error code is: -2

我的 BGI 放在 D:\BGI 目录下,里面的文件:
ATT.BGI
CGA.BGI
EGAVGA.BGI
HERC.BGI
IBM8514.BGI
PC3270.BGI

我机子的显卡是:NVIDIA AUadro NVS 140M。

另外,还想问问大家,C 语言的绘图库还有那些比较好用的。最好可以直接加的 VS 中就可以用的。
TC 那个编辑界面真的是太不方便了。
...全文
65 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Ghoststears 2008-10-21
  • 打赏
  • 举报
回复
来捧场的都给分啊。
呵呵。
Ghoststears 2008-10-21
  • 打赏
  • 举报
回复
呵呵,OK 了。

int gmode = -1;

的问题。

养成习惯了,喜欢用 -1.
skyergg 2008-10-21
  • 打赏
  • 举报
回复
int gmode = -1;


initgraph的第一个参数没有-1吧,你应该将它设置成0自主判断
太乙 2008-10-21
  • 打赏
  • 举报
回复
lz单步调试过了没?
w382120035 2008-10-21
  • 打赏
  • 举报
回复
直接用API吧

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧