[C] 返回最后一次不成功的图形操作的错误代码 →→→→→进入此内容的聊天室

来自 , 2019-08-09, 写在 C, 查看 104 次.
URL http://www.code666.cn/view/243facb2
  1. #include <graphics.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <conio.h>
  5.  
  6. int main(void)
  7. {
  8.    /* request auto detection */
  9.    int gdriver = DETECT, gmode, errorcode;
  10.  
  11.    /* initialize graphics and local variables */
  12.    initgraph(&gdriver, &gmode, "");
  13.  
  14.    /* read result of initialization */
  15.    errorcode = graphresult();
  16.  
  17.    if (errorcode != grOk)  /* an error occurred */
  18.    {
  19.       printf("Graphics error: %s\n", grapherrormsg(errorcode));
  20.       printf("Press any key to halt:");
  21.       getch();
  22.       exit(1); /* terminate with an error code */
  23.    }
  24.  
  25.    /* draw a line */
  26.    line(0, 0, getmaxx(), getmaxy());
  27.  
  28.    /* clean up */
  29.    getch();
  30.    closegraph();
  31.    return 0;
  32. }
  33.  

回复 "返回最后一次不成功的图形操作的错误代码"

这儿你可以回复上面这条便签

captcha