![C語言函數(shù)大全(h開頭)_第1頁](http://file4.renrendoc.com/view/9f29200b28d6ddbc1b65cb5331f86c04/9f29200b28d6ddbc1b65cb5331f86c041.gif)
![C語言函數(shù)大全(h開頭)_第2頁](http://file4.renrendoc.com/view/9f29200b28d6ddbc1b65cb5331f86c04/9f29200b28d6ddbc1b65cb5331f86c042.gif)
![C語言函數(shù)大全(h開頭)_第3頁](http://file4.renrendoc.com/view/9f29200b28d6ddbc1b65cb5331f86c04/9f29200b28d6ddbc1b65cb5331f86c043.gif)
![C語言函數(shù)大全(h開頭)_第4頁](http://file4.renrendoc.com/view/9f29200b28d6ddbc1b65cb5331f86c04/9f29200b28d6ddbc1b65cb5331f86c044.gif)
![C語言函數(shù)大全(h開頭)_第5頁](http://file4.renrendoc.com/view/9f29200b28d6ddbc1b65cb5331f86c04/9f29200b28d6ddbc1b65cb5331f86c045.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
C語言函數(shù)大全(h開頭)功能:建立一個硬件錯誤處理程序
用法:voidharderr(int(*fptr)());
程序例:
/*Thisprogramwilltrapdiskerrorsandprompt
theuserforaction.Tryrunningitwithno
diskindriveA:toinvokeitsfunctions.*/
#include
#include
#include
#defineIGNORE0
#defineRETRY1
#defineABORT2
intbuf[500];
/*definetheerrormessagesfortrappingdiskproblems*/
staticchar*err_msg[]={
“writeprotect“,
“unknownunit“,
“drivenotready“,
“unknowncommand“,
“dataerror(CRC)“,
“badrequest“,
“seekerror“,
“unknownmediatype“,
“sectornotfound“,
“printeroutofpaper“,
“writefault“,
“readfault“,
“generalfailure“,
“reserved“,
“reserved“,
“invaliddiskchange“
};
error_win(char*msg)
{
intretval;
cputs(msg);
/*promptforusertopressakeytoabort,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);
}
/*pragmawarn-parreduceswarningswhichoccur
duetothenonuseoftheparameterserrval,
bpandsitothehandler.*/
#pragmawarn-par
inthandler(interrval,intax,intbp,intsi)
{
staticcharmsg[80];
unsigneddi;
intdrive;
interrorno;
di=_DI;
/*ifthisisnotadiskerrorthenitwas
anotherdevicehavingtrouble*/
if(ax<0)
{
/*reporttheerror*/
error_win(“Deviceerror“);
/*andreturntotheprogramdirectlyrequestingabort*/
hardretn(ABORT);
}
/*otherwiseitwasadiskerror*/
drive=ax
errorno=di
/*reportwhicherroritwas*/
sprintf(msg,“Error:%sondrive%c\r\nA)bort,R)etry,I)gnore:“,
err_msg[errorno],’A’+drive);
/*
returntotheprogramviadosinterrupt0x23withabort,retry,
orignoreasinputbytheuser.
*/
hardresume(error_win(msg));
returnABORT;
}
#pragmawarn+par
intmain(void)
{
/*
installourhandleronthehardwareprobleminterrupt
*/
harderr(handler);
clrscr();
printf(“MakesurethereisnodiskindriveA:\n“);
printf(“Pressanykey....\n“);
getch()
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年企業(yè)機器質(zhì)押借款合同
- 2025年勞動解除合同標(biāo)準(zhǔn)條款
- 2025年抗瘧藥項目申請報告模范
- 2025年貨車租賃與運輸服務(wù)合同樣本
- 2025年國際貨物買賣合同與慣例
- 2025年專業(yè)清潔人員派遣協(xié)議
- 2025年二手車購買合同范本
- 2025年三板市場股權(quán)買賣協(xié)議
- 2025年伙伴開設(shè)教育機構(gòu)合作協(xié)議書模板
- 2025年繼電器研發(fā)策劃技術(shù)協(xié)議書范本
- 2024年湖南有色金屬職業(yè)技術(shù)學(xué)院高職單招職業(yè)技能測驗歷年參考題庫(頻考版)含答案解析
- 生物-遼寧省大連市2024-2025學(xué)年高三上學(xué)期期末雙基測試卷及答案
- Unit 4 A glimpse of the future 說課稿-2023-2024學(xué)年高二下學(xué)期英語外研版(2019)選擇性必修第三冊001
- 加氣站安全課件
- 《民營企業(yè)清廉建設(shè)評價規(guī)范》
- 智能RPA財務(wù)機器人開發(fā)教程-基于來也UiBot 課件 第2章-常用機器人流程自動化
- 品管圈PDCA改善案例-降低住院患者跌倒發(fā)生率
- 公務(wù)車輛定點加油服務(wù)投標(biāo)文件(技術(shù)方案)
- 安徽工程大學(xué)《回歸分析》2023-2024學(xué)年第一學(xué)期期末試卷
- 讀書分享《給教師的建議》課件
- 《中小學(xué)校園食品安全和膳食經(jīng)費管理工作指引》專題講座
評論
0/150
提交評論