C语言函数大全-h开头-完整版

上传人:20****03 文档编号:178994139 上传时间:2021-04-06 格式:DOC 页数:6 大小:19.50KB
返回 下载 相关 举报
C语言函数大全-h开头-完整版_第1页
第1页 / 共6页
C语言函数大全-h开头-完整版_第2页
第2页 / 共6页
C语言函数大全-h开头-完整版_第3页
第3页 / 共6页
C语言函数大全-h开头-完整版_第4页
第4页 / 共6页
C语言函数大全-h开头-完整版_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《C语言函数大全-h开头-完整版》由会员分享,可在线阅读,更多相关《C语言函数大全-h开头-完整版(6页珍藏版)》请在金锄头文库上搜索。

1、C语言函数大全(h开头)函数名: harderr功能: 建立一个硬件错误处理程序用法: void harderr(int (*fptr)();程序例:/*This program will trap disk errors and promptthe user for action. Try running it with nodisk in drive A: to invoke its functions.*/#include#include#include#define IGNORE 0#define RETRY 1#define ABORT 2int buf500;/*define th

2、e error messages for trapping disk problems*/static char *err_msg = write protect,unknown unit,drive not ready,unknown command,data error (CRC),bad request,seek error,unknown media type,sector not found,printer out of paper,write fault,read fault,general failure,reserved,reserved,invalid disk change

3、;error_win(char *msg)int retval;cputs(msg);/*prompt for user to press a key to abort, retry, ignore*/while(1)retval= getch();if (retval = a | retval = A)retval = ABORT;break;if (retval = r | retval = R)retval = RETRY;break;if (retval = i | retval = I)retval = IGNORE;break;return(retval);/*pragma war

4、n -par reduces warnings which occurdue to the non use of the parameters errval,bp and si to the handler.*/#pragma warn -parint handler(int errval,int ax,int bp,int si)static char msg80;unsigned di;int drive;int errorno;di= _DI;/*if this is not a disk error then it wasanother device having trouble*/i

5、f (ax 0)/* report the error */error_win(Device error);/* and return to the program directly requesting abort */hardretn(ABORT);/* otherwise it was a disk error */drive = ax & 0x00FF;errorno = di & 0x00FF;/* report which error it was */sprintf(msg, Error: %s on drive %crnA)bort, R)etry, I)gnore: ,err

6、_msgerrorno, A + drive);/*return to the program via dos interrupt 0x23 with abort, retry,or ignore as input by the user.*/hardresume(error_win(msg);return ABORT;#pragma warn +parint main(void)/*install our handler on the hardware problem interrupt*/harderr(handler);clrscr();printf(Make sure there is

7、 no disk in drive A:n);printf(Press any key .n);getch();printf(Trying to access drive A:n);printf(fopen returned %pn,fopen(A:temp.dat, w);return 0;函数名: hardresume功能: 硬件错误处理函数用法: void hardresume(int rescode);程序例:/* This program will trap disk errors and prompt the user for action. */* Try running it

8、with no disk in drive A: to invoke its functions */#include#include#include#define IGNORE 0#define RETRY 1#define ABORT 2int buf500;/* define the error messages for trapping disk problems */static char *err_msg = write protect,unknown unit,drive not ready,unknown command,data error (CRC),bad request

9、,seek error,unknown media type,sector not found,printer out of paper,write fault,read fault,general failure,reserved,reserved,invalid disk change;error_win(char *msg)int retval;cputs(msg);/* prompt for user to press a key to abort, retry, ignore */while(1)retval= getch();if (retval = a | retval = A)

10、retval = ABORT;break;if (retval = r | retval = R)retval = RETRY;break;if (retval = i | retval = I)retval = IGNORE;break;return(retval);/* pragma warn -par reduces warnings which occur due to the non use */* of the parameters errval, bp and si to the handler. */#pragma warn -parint handler(int errval

11、,int ax,int bp,int si)static char msg80;unsigned di;int drive;int errorno;di= _DI;/* if this is not a disk error then it was another device having trouble */if (ax 0)/* report the error */error_win(Device error);/* and return to the program directlyrequesting abort */hardretn(ABORT);/* otherwise it

12、was a disk error */drive = ax & 0x00FF;errorno = di & 0x00FF;/* report which error it was */sprintf(msg, Error: %s on drive %crnA)bort, R)etry, I)gnore: ,err_msgerrorno, A + drive);/* return to the program via dos interrupt 0x23 with abort, retry */* or ignore as input by the user. */hardresume(erro

13、r_win(msg);return ABORT;#pragma warn +parint main(void)/* install our handler on the hardware problem interrupt */harderr(handler);clrscr();printf(Make sure there is no disk in drive A:n);printf(Press any key .n);getch();printf(Trying to access drive A:n);printf(fopen returned %pn,fopen(A:temp.dat,

14、w);return 0;函数名: highvideo功能: 选择高亮度文本字符用法: void highvideo(void);程序例:#includeint main(void)clrscr();lowvideo();cprintf(Low Intensity textrn);highvideo();gotoxy(1,2);cprintf(High Intensity Textrn);return 0;函数名: hypot功能: 计算直角三角形的斜边长用法: double hypot(double x, double y);程序例:#include#includeint main(void)double result;double x = 3.0;double y = 4.0;result = hypot(x, y);printf(The hypotenuse is:

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 教学/培训

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号