closegraph

closegraph

目录导航

基本内容

closegraph   函数名: closegraph

  功 能: 关闭图形系统

  用 法: void far closegraph(void);

  程序例:

  #include

  #include

  #include

  #include

  int main(void)

  {

  /* request auto detection */

  int gdriver = DETECT, gmode, errorcode;

  int x, y;

  /* 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); /* terminate with an error code */

  }

  x = getmaxx() / 2;

  y = getmaxy() / 2;

  /* output a message */

  settextjustify(CENTER_TEXT, CENTER_TEXT);

  outtextxy(x, y, "Press a key to close the graphics system:");

  /* wait for a key */

  getch();

  /* closes down the graphics system */

  closegraph();

  printf("We're now back in text mode.\n");

  printf("Press any key to halt:");

  getch();

  return 0;

  }

相关百科
返回顶部
产品求购 求购