如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
函数大全(R开头)函数名:raise功能:向正在执行的程序发送一个信号用法:intraise(intsig);程序例:#includeintmain(void){inta,b;a=10;b=0;if(b==0)/*preemptdividebyzeroerror*/raise(SIGFPE);a=a/b;return0;}函数名:rand功能:随机数发生器用法:voidrand(void);程序例:#include#includeintmain(void){inti;printf("Tenrandomnumbersfrom0to99\n\n");for(i=0;i<10;i++)printf("%d\n",rand()%100);return0;}函数名:randbrd功能:随机块读用法:intrandbrd(structfcb*fcbptr,intreccnt);程序例:#include#include#include#includeintmain(void){charfar*save_dta;charline[80],buffer[256];structfcbblk;inti,result;/*getuserinputfilenamefordta*/printf("Enterdriveandfilename(nopath-i.e.a:file.dat)\n");gets(line);/*putfilenameinfcb*/if(!parsfnm(line,&blk,1)){printf("Errorincalltoparsfnm\n");exit(1);}printf("Drive#%dFile:%s\n\n",blk.fcb_drive,blk.fcb_name);/*openfilewithDOSFCBopenfile*/bdosptr(0x0F,&blk,0);/*saveolddta,andsetnewone*/save_dta=getdta();setdta(buffer);/*setupinfoforthenewdta*/blk.fcb_recsize=128;blk.fcb_random=0L;result=randbrd(&blk,1);/*checkresultsfromrandbrd*/if(!result)printf("ReadOK\n\n");else{perror("Errorduringread");exit(1);}/*readindatafromthenewdta*/printf("Thefirst128charactersare:\n");for(i=0;i<128;i++)putchar(buffer[i]);/*restorepreviousdta*/setdta(save_dta);return0;}函数名:randbwr功能:随机块写用法:intrandbwr(structfcp*fcbptr,intreccnt);程序例:#include#include#include#includeintmain(void){charfar*save_dta;charline[80];charbuffer[256]="RANDBWRtest!";structfcbblk;intresult;/*getnewfilenamefromuser*/printf("Enterafilenametocreate(nopath-ie.a:file.dat\n");gets(line);/*parsethenewfilenametothedta*/parsfnm(line,&blk,1);printf("Drive#%dFile:%s\n",blk.fcb_drive,blk.fcb_name);/*requestDOSservicestocreatefile*/if(bdosptr(0x16,&blk,0)==-1){perror("Errorcreatingfile");exit(1);}/*saveolddtaandsetnewdta*/save_dta=getdta();setdta(buffer);/*writenewrecords*/blk.fcb_recsize=256;blk.fcb_random=0L;result=randbwr(&blk,1);if(!result)printf("WriteOK\n");else{perror("Diskerr