




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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 the e
2、rror 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 foun
3、d","printer out of paper","write fault","read fault","general failure","reserved","reserved","invalid disk change"error_win(char *msgint retval;cputs(msg;/*prompt for user to press a key to abort, retry, ignore*/ while(1retva
4、l= 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 warn -par reduces warnings which occurdue to the non use of th
5、e parameters errval,bp and si to the handler.*/#pragma warn -parint handler(int errval,int ax,int bp,int sistatic char msg80;unsigned di;int drive;int errorno;di= _DI;/*if this is not a disk error then it wasanother device having trouble*/if (ax < 0/* report the error */error_win("Device err
6、or"/* 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 %crnAbort, Retry, Ignore: ",err_msgerrorno, 'A' + dr
7、ive;/*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 no disk in drive
8、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 th
9、e user for action. */ /* Try running it 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&qu
10、ot;,"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&quo
11、t;,"reserved","reserved","invalid disk change"error_win(char *msgint retval;cputs(msg;/* prompt for user to press a key to abort, retry, ignore */ while(1retval= getch(;if (retval = 'a' | retval = 'A'retval = ABORT;break;QQ291911320if (retval = 'r
12、9; | 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,int
13、 ax,int bp,int sistatic 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;/* othe
14、rwise it was a disk error */drive = ax & 0x00FF;errorno = di & 0x00FF;/* report which error it was */sprintf(msg, "Error: %s on drive %crnAbort, Retry, Ignore: ",err_msgerrorno, 'A' + drive;/* return to the program via dos interrupt 0x23 with abort, retry */* or ignore as i
15、nput 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 no disk in drive A:n"printf("Press any key .n"getch(;printf("Trying to access
16、 drive A:n"printf("fopen returned %pn",fopen("A:temp.dat", "w"return 0;函数名: highvideo 功能: 选择高亮度文本字符 用法: void highvideo(void; 程序例: #include int main(void clrscr(; lowvideo(; cprintf("Low Intensity textrn" highvideo(; gotoxy(1,2; cprintf("High Intensity Te
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 机器学习与过程控制的协同优化研究-洞察阐释
- 盐资源数字化评估-洞察阐释
- 仓储租赁合同附带仓储数据分析服务
- 柴油环保油品研发与应用合作协议
- 彩钢瓦品牌代理销售与市场推广合同
- 财务外包合同范本(含服务范围及质量要求)
- 茶叶品牌加盟与区域保护合同模板
- 生物可吸收材料在肩关节修复中的应用-洞察阐释
- 高铁站停车场车位租赁及高铁旅客服务协议
- 残疾人庇护性工坊用工管理与支持协议
- 期货交易制度跟期货交易流程课程(-)课件
- 病害与杀菌剂基础知识
- 体育与健康PPT(中职)全套完整教学课件
- 铁道车辆制动装置检修PPT(高职)完整全套教学课件
- 叉车应急预案及演练记录
- 直接打印800字作文纸
- 肉毒素培训的学习资料
- DB34T 5006-2023 太阳能光伏与建筑一体化技术规程
- D503-D505防雷与接地(下册)彩色版
- 大学期末复习-中兽医学期末考试重点
- 2023年科技特长生招生考试试卷word
评论
0/150
提交评论