函数大全(a开头)函数名:abort功能:异常终止一个进程用法:voidabort(void);程序例:#include#includeintmain(void){printf(Callingabort()\n);abort();return0;/*Thisisneverreached*/}函数名:abs功能:求整数的绝对值用法:intabs(inti);程序例:#include#includeintmain(void){intnumber=-1234;printf(number:%dabsolutevalue:%d\n,number,abs(number));return0;}函数名:absread,abswirte功能:绝对磁盘扇区读、写数据用法:intabsread(intdrive,intnsects,intsectno,void*buffer);intabswrite(intdrive,intnsects,intsectno,void*buffer);程序例:/*absreadexample*/#include#include#include#includeintmain(void){inti,strt,ch_out,sector;charbuf[512];printf(InsertadisketteintodriveAandpressanykey\n);getch();sector=0;if(absread(0,1,sector,&buf)!=0){perror(Diskproblem);exit(1);}printf(ReadOK\n);strt=3;for(i=0;i80;i++){ch_out=buf[strt+i];putchar(ch_out);}printf(\n);return(0);}函数名:access功能:确定文件的访问权限用法:intaccess(constchar*filename,intamode);程序例:#include#includeintfile_exists(char*filename);intmain(void){printf(DoesNOTEXIST.FILexist:%s\n,file_exists(NOTEXISTS.FIL)?YES:NO);return0;}intfile_exists(char*filename){return(access(filename,0)==0);}函数名:acos功能:反余弦函数用法:doubleacos(doublex);程序例:#include#includeintmain(void){doubleresult;doublex=0.5;result=acos(x);printf(Thearccosineof%lfis%lf\n,x,result);return0;}函数名:allocmem功能:分配DOS存储段用法:intallocmem(unsignedsize,unsigned*seg);程序例:#include#include#includeintmain(void){unsignedintsize,segp;intstat;size=64;/*(64x16)=1024bytes*/stat=allocmem(size,&segp);if(stat==-1)printf(Allocatedmemoryatsegment:%x\n,segp);elseprintf(Failed:maximumnumberofparagraphsavailableis%u\n,stat);return0;}函数名:arc功能:画一弧线用法:voidfararc(intx,inty,intstangle,intendangle,intradius);程序例:#include#include#include#includeintmain(void){/*requestautodetection*/intgdriver=DETECT,gmode,errorcode;intmidx,midy;intstangle=45,endangle=135;intradius=100;/*initializegraphicsandlocalvariables*/initgraph(&gdriver,&gmode,);/*readresultofinitialization*/errorcode=graphresult();/*anerroroccurred*/if(errorcode!=grOk){printf(Graphicserror:%s\n,grapherrormsg(errorcode));printf(Pressanykeytohalt:);getch();exit(1);/*terminatewithanerrorcode*/}midx=getmaxx()/2;midy=getmaxy()/2;setcolor(getmaxcolor());/*drawarc*/arc(midx,midy,stangle,endangle,radius);/*cleanup*/getch();closegraph();return0;}函数名:asctime功能:转换日期和时间为ASCII码用法:char*asctime(conststructtm*tblock);程序例:#include#include#includeintmain(void){structtmt;charstr[80];/*sampleloadingoftmstructure*/t.tm_sec=1;/*Seconds*/t.tm_min=30;/*Minutes*/t.tm_hour=9;/*Hour*/t.tm_mday=22;/*DayoftheMonth*/t.tm_mon=11;/*Month*/t.tm_year=56;/*Year-doesnotincludecentury*/t.tm_wday=4;/*Dayoftheweek*/t.tm_yday=0;/*Doesnotshowinasctime*/t.tm_isdst=0;/*IsDaylightSavTime;doesnotshowinasctime*//*convertsstructuretonullterminatedstring*/strcpy(str,asctime(&t));printf(%s\n,str);return0;}函数名:asin功能:反正弦函数用法:doubleasin(doublex);程序例:#include#includeintmain(void){doubleresult;doublex=0.5;result=asin(x);printf(Thearcsinof%lfis%lf\n,x,result);return(0);}函数名:assert功能:测试一个条件并可能使程序终止用法:voidassert(inttest);程序例:#include#include#includestructITEM{intkey;intvalue;};/*additemtolist,makesurelistisnotnull*/voidadditem(structITEM*itemptr){assert(itemptr!=NULL);/*additemtolist*/}intmain(void){additem(NULL);return0;}函数名:atan功能:反正切函数用法:doubleatan(doublex);程序例:#include#includeintmain(void){doubleresult;doublex=0.5;result=atan(x);printf(Thearctangentof%lfis%lf\n,x,result);return(0);}函数名:atan2功能:计算Y/X的反正切值用法:doubleatan2(doubley,doublex);程序例:#include#includeintmain(void){doubleresult;doublex=90.0,y=45.0;result=atan2(y,x);printf(Thearctangentratioof%lfis%lf\n,(y/x),result);return0;}函数名:atexit功能:注册终止函数用法:intatexit(atexit_tfunc);程序例:#include#includevoidexit_fn1(void){printf(Exitfunction#1called\n);}voidexit_fn2(void){printf(Exitfunction#2called\n);}intmain(void){/*postexitfunction#1*/atexit(exit_fn1);/*postexitfunction#2*/atexit(exit_fn2);return0;}函数名:atof功能:把字符串转换成浮点数用法:doubleatof(constchar*nptr);程序例:#include#includeintmain(void){floatf;char*str=12345.67;f=atof(str);printf(string=%sfloat=%f\n,str,f);return0;}函数名:atoi功能:把字符串转换成长整型数用法:intatoi(constchar*nptr);程序例:#include#includeintmain(void){intn;char*str=12345.67;n=atoi(str);printf(string=%sinteger=%d\n,str,n);return0;}函数名:atol功能:把字符串转换成长整型数用法:longatol(constchar*nptr);程序例:#include#includeintmain(void){longl;char*str=98765432;l=atol(lstr);printf(string=%sinteger=%ld\n,str,l);return(0);}函数大全(b开头)函数名:bar功能:画一个二维条形图用法:voidfarbar(intleft,inttop,intright,intbottom);程序例:#include#include#include#includeintmain(void){/*requestautodetection*/intgdriver=DETECT,gmode,errorcode;intmidx,midy,i;/*initializegraphicsandlocalvariables*/initgraph(&gdriver,&gmode,);/*readresultofinitialization*/errorcode=graphresult();if(errorcode!=grOk)/*anerroroccurred*/{printf(Graphicserror:%s\n,grapherrormsg(errorcode));printf(Pressanykeytohalt:);getch();exit(1);/*terminatewithanerrorcode*/}midx=getmaxx()/2;midy=getmaxy()/2;/*loopthroughthefillpatterns*/for(i=SOLID_FILL;i{/*setthefillstyle*/setfillstyle(i,getmaxcolor());/*drawthebar*/bar(midx-50,midy-50,midx+50,midy+50);getch();}/*cleanup*/closegraph();return0;}函数名:bar3d功能:画一个三维条形图用法