21xrx.com
2024-04-26 14:09:25 Friday
登录
文章检索 我的文章 写文章
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按任意键退出。

  
  

评论区

{{item['qq_nickname']}}
()
回复
回复