单片机学习库函数详解_第1页
单片机学习库函数详解_第2页
单片机学习库函数详解_第3页
单片机学习库函数详解_第4页
单片机学习库函数详解_第5页
已阅读5页,还剩36页未读 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

PICC库函PICCPICC库函PICC编译器的库函数。每个函数均从函数名开始,然后按照以下提要C语言定义以及定义函数的头文件。描述对函数及其目的进行叙述性描述。例程:给出一个能说明该函数的应用例子。参阅:给出相关联的函数。返回值:如果函数有返回值,则在本标题下将给出返回值的类型和性质,同时还包括 ABS函数#includeintabs(intabs函数返回变量j的绝对值3.程#include<stdio.h>#include<stdlib.h>main{inta=-printf("Theabsolutevalueof%dis}4.返回值j ACOS#includedoubleacos(doubleacos()函数是cos()的反函数。函数参数在[-1,1]区间内,返回值是一个用弧度表3.例程1#include<math.h>#include#include<math.h>#includemain{floatfor(i=-1.0,i<1.0;i+={a=acos(i)*180.0/3.141592;printf("acos(%f)=%fdegrees\n",i,a);}}4.阅sin(),cos(),tan(),asin(),atan(),atan2(5.返回值 ASCTIME函#includechar*asctime(structtm*asctimet从上structtm结构体中获得时间,返回描述当前日期和时SunSep1601:03:52当前时间,通过localtime函数将其转换成一个structtm指针,最后转换成ASCII印出来。其中,time()函数需要用户提供(详情请参阅time()函数3.例程#include<stdio.h>#include<time.h>main{time_tclock;structtm*tp;tp=2}4.参阅}4.参阅ctime(),gmtime(),localtime(),time(返回值注意:由于编译器不提供time()例行程序,故在本例程中它需要由用户提供。详情请参照time函数据类structtminttm_sec;inttm_min;inttm_hour;inttm_mday;inttm_mon;inttm_year;inttm_wday;inttm_yday;inttm_isdst;4ASIN#includedoubleasin(doubleasin(函数是sin(的反函数。它的函数参数在[-1,1]3.例程#include<math.h>#include<stdio.h>main{floatfor(i=-1.0;i<1.0;i+={a=asin(i)*180.0/3.141592;printf("asin(%f)=%fdegrees\n",i,a);}}34.参阅sin(),cos(),tan(),acos(),atan(),4.参阅sin(),cos(),tan(),acos(),atan(),atan2(5.返回值5ATAN#includedoubleatan(double而且有tan(e)=x(x为函数参数3.程#include<stdio.h>#include<math.h>main{}4.阅sin(),cos(),tan(),asin(),acos(),atan2(返回值5. ATAN2#includedoubleatan2(doubley,double本函数返回y/x3.程#include<stdio.h>#include<math.h>main{}4.阅4sin(),cos(),tan(),asin(),acos(sin(),cos(),tan(),asin(),acos(),atan(5.返回值 ATOF#includedoubleatof(constchar*3.程#include<stdlib.h>#include<stdio.h>main{charbuf[80];doublei;i=printf("Read%s:convertedto}4.阅atoi(),atol(5.返回值本函数返回一个双精度浮点数。如果字符串中没有发现任何数字,则返回0.08ATOI#includeintatoi(constchar*atoi()函数扫描传递过来的字符串,跳过开头的空格并读取其符号;制数的ASCII表达式转换成整数3.例程#include<stdlib.h>#include5main{charbuf[80];inti;i=printf("Read%s:main{charbuf[80];inti;i=printf("Read%s:convertedto}4.参阅xtoi(),atof(),atol(5.返回值9ATOL#includelongatol(constchar*atol函数扫描传递过来的字符串,并跳过字符串开头的空格;然后将十进制数的3.例程#include<stdlib.h>#include<stdio.h>main{charbuf[80];longi;i=printf("Read%s:convertedto}参阅4.atoi(),atof(返回值5.CEIL#include6doubleceil(double本函数对函数参数ff例程#include<stdio.h>#include<math.h>doubleceil(double本函数对函数参数ff例程#include<stdio.h>#include<math.h>main{doublej;scanf("%lf",printf("Theceilingof%lfis} COS#includedoublecos(double3.程#include<math.h>#include<stdio.h>#defineC3.141592/180.0main{doublefor(i=0;i<=180.0;i+=printf("sin(%3.0f)=%f,cos=}4.阅sin(),tan(),asin(),acos(),atan(),atan2(5.返回值返回一个双精度数,区间为[-1,1]COSHSINHTANH#includedoublecosh(double7doublesinh(doubledoubletanh(double这些函数都是cos(),doublesinh(doubledoubletanh(double这些函数都是cos(),sin()和tan()3.例程#include<stdio.h>#include<math.h>main{printf("%f\n",cosh(1.5));printf("%f\n",sinh(1.5));}4.返回值cosh()函数返回双曲余弦值,sinh()函数返回双曲正弦值,tanh()函数返回双曲正切CTIME#includechar*ctime(time_t*ctime()函数将函数参数所指的时间转换成字符串,其结构与asctime()3.程#include<stdio.h>#include<time.h>main{time_tclock;}4.阅gmtime(),localtime(),asctime(),time(5.返回值()()6.数据类8typedeflongDIEI#include<pic.h>voidei(void)voidtypedeflongDIEI#include<pic.h>voidei(void)void()()的连续字期间出现中断,则函数getticks()将返回错误的值。3.程#include<pic.h>longcount;voidinterrupt{}long{longval/*在访问count变量前禁止中断,保证访问的连续性*/di();val=count;ei();returnval;}DIV#includediv_tdiv(intnumer,intdiv(3.程#include<stdlib.h>#include<stdio.h>main{9div_tx=printf("quotientdiv_tx=printf("quotient=%d,remainder=}返回值返回一个包括商和余数的结构体div_t。4.5.数据typedef{intquot;int}EEPROM_READ、EEPROM_WRITE函#includeunsignedchareeprom_read(unsignedcharvoideeprom_write(unsignedcharaddr,unsignedcharEEPO3.例程#include<pic.h>main{unsignedchardata;address=0x10;data=}注意:如果调用eeprom_write()函数后需即刻调用eeprom_read()函数,则必须查询EEPROM寄存以确保写入完毕。全局中断使能位(GIE)在eeprom_write(程序中重新恢复(写EEPROM时需要关闭EVAL_POLY函#includedoubleeval_poly(doublex,constdouble*#includedoubleeval_poly(doublex,constdouble*d,inty=x*x*d2+x*d1+3.程#include<stdio.h>#include<math.h>main{doubledoubled[3]={1.1,3.5,2.7};x=2.2;y=printf("Thepolynomialevaluatedat%fis}4.返回值EXP#includedoubleexp(doubleexp()函数返回参数的指数函数值,即ef(f为函数参数3.程#include<math.h>#include<stdio.h>main{doublefor(f=0.0;f<=5;f+=printf("eto%1.0f=}4.阅log(),log10(),pow(FABS#includedoublefabs(double3.程#include<stdio.h>#includeFABS#includedoublefabs(double3.程#include<stdio.h>#include<math.h>main{printf("%f%f\n",fabs(1.5),fabs(-}4.阅abs(FLOOR函#includedoublefloor(double本函数对函数参数取整,取整后的返回值不大于函数参数f3.程#include<stdio.h>#include<math.h>main{printf("%f\n",floor(1.5));printf("%f\n",floor(-}FREXP函#includedoublefrexp(doublef,int*frexp()函数将一个浮点数分解成规格化小数和2的整数次幂两部分,整数幂部分存于指针p所指的int单元中。本函数的返回值x或在区间(0.5,1.0)内,或为0;而且有f=x×2p。如果f为0,则分解出来的两部分均为0。3.程#include<math.h>#include<stdio.h>main{doublef3.程#include<math.h>#include<stdio.h>main{doublef;inti;f=frexp(23456.34,&i);printf("23456.34=%f*2^%d\n",f,i);}4.阅ldexp(GET_CAL_DATA函#includedoubleget_cal_data(constunsignedchar*本函数从PIC14000标定空间返回一个32位的浮点标定数据。只有利用这个函数才3.程#include<pic.h>main{doublex;x=get_cal_data(KREF);/*获得参考斜率(slopereferenceratio)*/y=TWDT;/*获得WDT溢出时间*/}4.返回值注意:本函数仅用于PICGMTIME函#includestructtm*gmtime(time_t*t所指的时间分解,并且存于结构体中,精确度为秒。其中,tt所指的时间分解,并且存于结构体中,精确度为秒。其中,t3.程#include<stdio.h>#include<time.h>main{time_tclock;structtm*tp;tp=printf("It’s%dinLondon\n",tp-}4.阅ctime(),asctime(),time(),localtime(返回值返回tm()()5.6.数据typedeflongtime_t;structtm{inttm_sec;inttm_min;inttm_hour;inttm_mday;inttm_mon;inttm_year;inttm_wday;inttm_yday;inttm_isdst;等函数#include<ctype.h>intisalnum(charc)intisalpha(charc)intisascii(charc)intiscntrl(charintisdigit(charc)intislower(charc)intisprint(charc)intisgraph(charintisdigit(charc)intislower(charc)intisprint(charc)intisgraph(charc)intispunct(charc)intisspace(charintisupper(charc)intisxdigit(charisalpha(c)isascii(c)iscntrl(c)isdigit(c)islowerc)isprint(c)isgraphc)ispunct(c)isspace(c)isupperc)isxdigitc)例程#include#include<stdio.h>main{charbuf[80];inti;i=c是空格键、TAB键或换行符c在A~Z范围内c在0~9、a~f或A~F范围内buf[i]=printf("’%s’isthe}参toupper(),tolower(),toascii(KBHIT函#includebitkbhit如果键盘上的字符被按下,函数返回1;否则返回0。通常,该字符可通过getch()KBHIT函#includebitkbhit如果键盘上的字符被按下,函数返回1;否则返回0。通常,该字符可通过getch()3.程#include<conio.h>main{inti;while(!kbhit()){cputs("I’mwaiting..");for(i=0;i!=1000;}}4.阅getch(),getche(返回值注意:程序的主体需由用户实现,其主要框架可以从sources目录下直接获得5.LDEXP#includedoubleldexp(doublef,intldexp(函数是frexp(i3.例程#include<math.h>#include<stdio.h>main{doublef=printf("1.0*2^10=}4.参阅frexp(5.返回值本函数返回浮点数fiLDIV#include}4.参阅frexp(5.返回值本函数返回浮点数fiLDIV#includeldiv_tldiv(longnumber,long3.例程#include<stdlib.h>#include<stdio.h>main{ldiv_tlt=printf("Quotient=%ld,remainder=}4.参阅div(返回值返回值是结构体ldiv_t数据结typedef{longquot;/*longrem;/*余数5.6.LOCALTIME函#includestructtm*localtime(time_t*需要考虑全局整型变量time_zone中的内容,因为它包含有本地时区位于格林威治以西的函数的返回值将与gmtime()的相同。3.例#include#include<time.h>char*wday[]={main{time_tclock;structtm*tp;tp=printf("Todayis%s\n",wday[tp-}4.阅ctime(),asctime(),time(返回值本函数返回tm()()5.6.数据typedeflongtime_t;structtm{inttm_sec;inttm_min;inttm_hour;inttm_mday;inttm_mon;inttm_year;inttm_wday;inttm_yday;inttm_isdst;LOGLOG10#includedoublelog(doublef)doublelog10(doublef)log(函数返回f的自然对数值。log10(函数返回f#includedoublelog(doublef)doublelog10(doublef)log(函数返回f的自然对数值。log10(函数返回f以103.程#include<math.h>#include<stdio.h>main{doublefor(f=1.0;f<=10.0;f+=1.0)printf("log(%1.0f)=%f\n",f,log(f));}4.阅exp(),pow(返回值5.MEMCHR函#include/*初级和中级系列单片机constvoid*memchr(constvoid*block,intval,size_t/*高级系列单片机void*memchr(constvoid*block,intval,size_tmemchr函数与strchr函数在功能上类似;但前者没有在字符串中寻找null(空)中止字符的功能。memchr函数实现在一段规定了长度的内存区域中寻找特定的字节。它3.例程#include<string.h>#include<stdio.h>unsignedintary[]={1,5,0x6789,0x23};main{char*cp=memchr(ary,0x89,sizeofprintf("notfound\n");printf("Foundatoffset%u\n"printf("notfound\n");printf("Foundatoffset%u\n",cp-(char}4.参阅strchr(5.返回值NULLMEMCMP函#includeintmemcmp(constvoid*s1,constvoid*s2,size_tmemcmp()函数的功能是比较两块长度为n的内存中变量的大小,类似strncmp函码字符顺序被用来比较;但如果内存块中包含非ASCII码字符,则返回值不确定。测试3.程#include<stdio.h>#include<string.h>main{intbuf[10],cow[10],i;buf[0]=1;buf[2]=cow[0]=cow[2]=buf[1]=cow[1]=i=memcmp(buf,cow,3*sizeof(int));if(i<0)printf("lessthan\n");elseif(i>0)printf("Greaterthan\n");}4.参阅strncpy(),strncmp(),strchr(),memset(),4.参阅strncpy(),strncmp(),strchr(),memset(),5.返回值s1s2变量时,函数返回值分别为-1,0或1。MEMCPY函#include/*低级或中级系列单片机void*memcpy(void*d,constvoid*s,size_t/*高级系列单片机farvoid*memcpy(farvoid*d,constvoid*s,size_t,3.程#include<string.h>#include<stdio.h>main{charmemset(buf,0,sizeofbuf);memcpy(buf,"apartialstring",10);printf("buf=’%s’\n",buf);}4.阅strncpy(),strncmp(),strchr(),5.返回值memcpy() MEMMOVE函#include/*低级或中级系列单片机void*memmove(void*s1,constvoid*s2,size_t/*高级系列单片机farvoid*memmove(farvoid*s1,constvoid*s2,size_tmemmove()函数与memcpy()函数相似,但memmove()3.参阅strncpy(),strncmp(),strchr(),返回值memmove()4.MEMSET函memmove()函数与memcpy()函数相似,但memmove()3.参阅strncpy(),strncmp(),strchr(),返回值memmove()4.MEMSET函#include/*低级和中级系列的单片机*/void*memset(void*s,intc,size_tn)/*高级系列单片机farvoid*memset(farvoid*s,intc,size_tmemset()函数将字节c存储到指针s指向的,内存开始的n个内存字节3.例程#include<string.h>#include<stdio.h>main{charstrcpy(abuf,"Thisisastring");memset(abuf,’x’,5);printf("buf=’%s’\n",}4.参阅strncpy(),strncmp(),strchr(),memcpy(),MODF#includedoublemodf(doublevalue,double*173.例程#include#includemain{doublei_val,main{doublei_val,f_val=modf(-3.17,}4.返回值PERSIST_CHECK,PERSIST_VALIDATE函数#includeintpersist_check(intflag)voidpersist_validate(void)persist_check()函数要用到非可变(non-volatile)的RAM变量,这些变量在定义时被数,并用到一个存储在隐藏变量中的虚拟数据,且由persist_validate()函数计算得到一个3.程#include<sys.h>#include<stdio.h>main{printf("Resetcountinvalid-zeroed\n");printf("Resetnumber%ld\n",reset_count);reset_count++;/*updatecount*/persist_validate();/*andchecksum*/continue;/*sleepuntilnextreset}4.返回值,,(非零POW#includedoublepow(doublef,doublepow()POW#includedoublepow(doublef,doublepow()函数表示第一个参数f的p次幂3.程#include<math.h>#include<stdio.h>main{doublefor(f=1.0;f<=10.0;f+=printf("pow(2,%1.0f)=%f\n",f,pow(2,}4.阅log(),log10(),返回值返回值为f的p5.PRINTF函#includeunsignedcharprintf(constchar*fmt,(tout转换格式的形式为%m.nc。其中%表示格式,m表示选择的字符宽度,n表示选择的如果指针变量为十进制常数,例如格式为%*doxXuS打印一个字符串——函数参数值被认为是字符型指针。最多从字符串中取n符打印,字符宽度为m符打印,字符宽度为m 3.例程printf("Total=%4d%%",23)输出为’Total=23%’printf("Sizeis%lx",size)这里size为长整型十六进制变量。注意当使用%s时,精度只对中级和高级printf("Name=%.8s",输出为’Name=printf("xx%*d",3,输出为’xx/*vprintf例程*/#include<stdio.h>error(char*s,{va_listap;va_start(ap,s);printf("Error:");vprintf(s,ap);}main{inti;i=error("testing12%d",}参见sprintf()函数4.返回值printf()将返回的字符值写到标准输出口。注意返回值为字符型,而不是整形关PICC–L的描述以及有关HPDPIC长整型关PICC–L的描述以及有关HPDPIC长整型格式在printf的菜单选项RAND#includeintrand每次被调用后,以随机数据形式出现。这一运算规则将产生一个从同一起点开始的确定3.例程#include<stdlib.h>#include<stdio.h>#include<time.h>main{time_ttoc;inti;for(i=0;i!=10;i++)printf("%d\t",rand());}参见srand()函数()SIN#includedoublesin(double3.例#include<math.h>#include<stdio.h>#defineC3.141592/180.0main{doublefor(i=0;main{doublefor(i=0;i<=180.0;i+=printf("sin(%3.0f)=%f,cos=%f\n",i,sin(i*C),}4.参阅cos(),tan(),asin(),acos(),atan(),5.返回值返回值为参数f SPRINTF函#include/*中级和低级系列单片机unsignedcharsprintf(char*buf,constchar*fmt,/*高级系列单片机unsignedcharsprintf(farchar*buf,constchar*fmt,sprintf()函数printf()函数操作基本相同只是输出在不同的输出终端,所有的字符被放到buf缓冲器。字符串带有空格结束符,buf缓冲器中的数据被返回。printf()3.返回值sprintf()函数的返回值为被放入缓冲器中的数据。注意,返回值为字符型而非整型SQRT#includedoublesqrt(doublesqrt()函数利用牛顿法得到参数的近似平方根3.程#include<math.h>#include<stdio.h>main{doublefor(i=0;i<=20.0;i+=printf("squarerootof%.1f=%f\n",i,}4.返回值SRAND函#includevoid4.返回值SRAND函#includevoidsrand(unsignedintsrand()函数是在调用rand()函数时被用来初始化随机数据发生器的。它为rand()函3.例程#include<stdlib.h>#include<stdio.h>#include<time.h>main{time_ttoc;inti;for(i=0;i!=10;i++)printf("%d\t",rand());}rand()STRCAT函#include/*char*strcat(char*s1,constchar*/*高级系列单片机farchar*strcat(farchar*s1,constchar*s2s1的后面。新的字符串以空格作为结束符。指针型参数s1指向的字符数组必须保证大于结果字符串。3.例程#include<string.h>#include<stdio.h>main{charbuffer[256];char*s1,*s2;strcpy(buffer,#include<string.h>#include<stdio.h>main{charbuffer[256];char*s1,*s2;strcpy(buffer,"Startofs1=s2="...endofline";strcat(s1,s2);printf("Length=%d\n",strlen(buffer));printf("string=\"%s\"\n",buffer);}4.阅strcpy(),strcmp(),strncat(),返回值5.STRCHR,STRICHR函数#include/*中级和低级系列单片机constchar*strchr(constchar*s,intc)constchar*strichr(constchar*s,intc)/*高级系列单片机char*strchr(constchar*s,intchar*strichr(constchar*s,intstrchr()sc。如果找到了,则字符指针被返回0。Strichr()strchr()3.例程#include<stdio.h>main{staticchartemp[]="Hereitis...";charc=’s’;if(strchr(temp,printf("Character%cwasfoundinstring\n",printf("Nocharacterwasfoundin}4printf("Nocharacterwasfoundin}4.参阅strrchr(),strlen(),5.返回值0STRCMP,STRICMP函数#includeintstrcmp(constchar*s1,constchar*s2)intstricmp(constchar*s1,constchar*s2)strcmp()2s1表进行的。Stricmp()函数功能和strcmp()函数完全一样。3.例#include<string.h>#include<stdio.h>main{intif((i=strcmp("ABC","ABc"))<0)printf("ABCislessthanABc\n");elseif(i>0)printf("ABCisgreaterthanprintf("ABCisequalto}4.参阅strlen(),strncmp(),strcpy(),5.返回值-11STRCPY函#include/*低级和中级系列单片机char*strcpy(char*#include/*低级和中级系列单片机char*strcpy(char*s1,constchar*/*高级系列单片机farchar*strcpy(farchar*s1,constchar*s2s1s23.程#include<string.h>#include<stdio.h>main{charbuffer[256];char*s1,*s2;strcpy(buffer,"Startofline");s1=buffer;s2="...endofline";strcat(s1,s2);printf("Length=%d\n",printf("string=\"%s\"\n",}4.阅strncpy(),strlen(),strcat(),5.返回值STRCSPN函#includesize_tstrcspn(constchar*s1,constchar*strcspn()函数用于取得在字符串常数s1中有而字符串常s23.程#include<stdio.h>#include<string.h>main{staticcharset[]=printf("%d\n",strcspn("abcdevwxyz",set));printf("%d\n",strcspn("xxxbcadefs",set));printf("%d\n",strcspn("1234567890",set));}参见strspn()函数4.返回值printf("%d\n",strcspn("abcdevwxyz",set));printf("%d\n",strcspn("xxxbcadefs",set));printf("%d\n",strcspn("1234567890",set));}参见strspn()函数4.返回值STRLEN函#includesize_tstrlen(constchar*strlen()s13.例程#include<string.h>#include<stdio.h>main{charbuffer[256];char*s1,*s2;strcpy(buffer,"Startofline");s1=buffer;s2="...endofline";strcat(s1,s2);printf("Length=%d\n",strlen(buffer));printf("string=\"%s\"\n",buffer);}4.返回值 STRNCAT函#include/*低级和中级系列单片机char*strncat(char*s1,constchar*s2,size_t/*高级系列单片机farchar*strncat(farchar*s1,constchar*s2,size_ts2s1ns1指向的字符数组应足够大,3.程#include<string.h>#include<stdio.h>mains1指向的字符数组应足够大,3.程#include<string.h>#include<stdio.h>main{charbuffer[256];char*s1,*s2;strcpy(buffer,"Startofline");s1=buffer;s2="...endofline";strncat(s1,s2,5);printf("Length=%d\n",strlen(buffer));printf("string=\"%s\"\n",buffer);}4.阅strcpy(),strcmp(),strcat(),返回值5.STRNICMP函数#includeintstrncmp(constchar*s1,constchar*s2,size_tn)intstrnicmp(constchar*s1,constchar*s2,size_tn)据字符串s1是否小于、等于或大于字符串s2,返回一个有符号数。比较是根据ASCII字顺序进行的。Strnicmp()函数与之相同3.例程#include<stdio.h>#include<string.h>main{inti=strcmp("abcxyz","abcxyz");if(i==0)printf("Bothstringsareelseif(i>printf("String2lessthanstring1\n");printf("String2iselseif(i>printf("String2lessthanstring1\n");printf("String2isgreaterthanstring}4.参阅strlen(),strcmp(),strcpy(),5.返回值 STRNCPY函#include/*低级和中级系列单片机char*strncpy(char*s1,constchar*s2,size_t/*高级系列单片机farchar*strncpy(farchar*s1,constchar*s2,size_t这个函数将带结束符的字符串s2拷贝到字符指针s1指向的字符数组。最多有n个字3.程#include<string.h>#include<stdio.h>main{charbuffer[256];char*s1,*s2;strncpy(buffer,"Startofline",6);s1=buffer;s2="...endofline";strcat(s1,s2);printf("Length=%d\n",strlen(buffer));printf("string=\"%s\"\n",buffer);}4.阅strcpy(),strcat(),strlen(),5.返回值指针s1指向的目的缓冲区 STRPBRK函#include/*低级和中级系列单片机constchar STRPBRK函#include/*低级和中级系列单片机constchar*strpbrk(constchar*s1,constchar*/*高级系列单片机char*strpbrk(constchar*s1,constchar*s23.程#include<stdio.h>#include<string.h>main{char*str="Thisisastring.";while(str!=NULL){printf("%s\n",strstr=strpbrk(str+1,"aeiou"}}返回值4.STRRCHR,STRRICHR函数#include/*中级和低级系列单片机*/constchar*strrchr(char*s,intc)constchar*strrichr(char*s,intc)/*高级系列单片机char*strrchr(char*s,intc)char*strrichr(char*s,intc)数和strrchr()函数完全一样。3.例程#include#includemain{char*str="Thisisastring.";while(str!=NULL){printf("%s\n",main{char*str="Thisisastring.";while(str!=NULL){printf("%s\n",strstr=strrchr(str+1,}}4.阅strchr(),strlen(),strcmp(),strcpy(),返回值5.STRSPN函#includesize_tstrspn(constchar*s1,constchar*strspn()函数返回字符串s1中包含的、完全由字符串s2组成的字符的长度3.程#include<stdio.h>#include<string.h>main{printf("%d\n",strspn("Thisisastring","This"));printf("%d\n",strspn("Thisisastring","this"));}参见strcspn()函数4.返回值 STRSTR,STRISTR函数#include/*中级和低级系列单片机constchar*strstr(constchar*s1,constchar*s2)constchar*stristr(constchar*s1,constchar*s2)/*高级系列单片机char*strstr(con

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论