功 能: 返回一個錯誤信息串的指針
用 法: char *far grapherrormsg(int errorcode);
程式例:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#define NONSENSE -50
int main(void)
{
/* FORCE AN ERROR TO OCCUR */
int gdriver = NONSENSE, gmode, errorcode;
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
/* if an error occurred, then output a */
/* descriptive error message. */
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
/* draw a line */
line(0, 0, getmaxx(), getmaxy());
/* clean up */
getch();
closegraph();
return 0;
}
相關詞條
-
grapherrormsg
grapherrormsg,函式名。調用該函式可返回一個錯誤信息串的指針。
-
C語言庫函式
("Graphics error: %s\n", grapherrormsg...
定義 內容介紹 相關概念 常用的庫函式 -
registerbgidriver
", grapherrormsg(errorcode)); printf("Press any... error: %s\n", grapherrormsg(errorcode...
函式功能 程式示例 -
Bar
("Graphics error: %sn", grapherrormsg...
-
setcolor
: %s\n", grapherrormsg(errorcode...
簡介 程式例 -
moveto()
("Graphics error: %s\n", grapherrormsg...
名稱 程式例 -
rectangle()
("Graphics error: %s\n", grapherrormsg...
-
detectgrap
\n", \ grapherrormsg(errorcode...
解釋 程式例 -
drawpoly
", \ grapherrormsg(errorcode...
解釋 程式例