C中的grapherrormsg函数
2021-07-07 18:49:01
深夜i
--
--
C
中
的
g
r
a
p
h
e
r
r
o
r
m
s
g
函
数
grapherrormsg 函数返回错误消息字符串。
声明: char *grapherrormsg( int errorcode );
grapherrormsg的C编程代码
#include <graphics.h>
#include <stdlib.h>
#include <conio.h>
main()
{
int gd, gm, errorcode;
initgraph(&gd, &gm, "C:\\TC\\BGI");
errorcode = graphresult();
if(errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to exit.");
getch();
exit(1);
}
getch();
closegraph();
return 0;
}
在上面的程序中我们没有写gd = DETECT。运行这个程序后我们得到输出:-Graphics error: Graphics hardware not detected按任意键退出。
上一篇:
idea打包java可执行jar包
下一篇:
c中的图像大小函数
评论区