长风破浪会有时,直挂云帆济沧海

Dream Word

博客园 首页 新随笔 联系 订阅 管理

//比较字符串s1和s2的前n个字节是否相等

int bcmp(const void* s1,const void*s2,int n);

//将字符串src的前n个字节复制到dest中

void bcopy(const void *src,void *dest,int n);

//设置字节字符串s的前n个字节为0

void bzero(void *s,int n);

//由src所指内存区域复制不多于count个个字节到dest所指内存区域,如果遇到ch则停止

void *memccpy(void *dest,void *src,unsigned char ch,unsigned int count);

原型:extern void *memchr(void *buf, char ch, unsigned count);

  用法:#include <string.h>
  
  功能:从buf所指内存区域的前count个字节查找字符ch。
  
  说明:当第一次遇到字符ch时停止查找。如果成功,返回指向字符ch的指针;否则返回NULL。
原型:extern int memcmp(void *buf1, void *buf2, unsigned int count);
        
  用法:#include <string.h>
  
  功能:比较内存区域buf1和buf2的前count个字节。
  
  说明:
        当buf1<buf2时,返回值<0
        当buf1=buf2时,返回值=0
        当buf1>buf2时,返回值>0
原型:extern void *memcpy(void *dest, void *src, unsigned int count);

  用法:#include <string.h>
  
  功能:由src所指内存区域复制count个字节到dest所指内存区域。
  
  说明:src和dest所指内存区域不能重叠,函数返回指向dest的指针。
原型:extern int memicmp(void *buf1, void *buf2, unsigned int count);
        
  用法:#include <string.h>
  
  功能:比较内存区域buf1和buf2的前count个字节但不区分字母的大小写。
  
  说明:memicmp同memcmp的唯一区别是memicmp不区分大小写字母。
        当buf1<buf2时,返回值<0
        当buf1=buf2时,返回值=0
        当buf1>buf2时,返回值>0
原型:extern void *memmove(void *dest, const void *src, unsigned int count);
        
  用法:#include <string.h>
  
  功能:由src所指内存区域复制count个字节到dest所指内存区域。
  
  说明:src和dest所指内存区域可以重叠,但复制后src内容会被更改。函数返回指向dest的指针。
原型:extern void *memset(void *buffer, int c, int count);
        
  用法:#include <string.h>
  
  功能:把buffer所指内存区域的前count个字节设置成字符c。
  
  说明:返回指向buffer的指针。
原型:extern void movmem(void *src, void *dest, unsigned int count);
        
  用法:#include <string.h>
  
  功能:由src所指内存区域复制count个字节到dest所指内存区域。
  
  说明:src和dest所指内存区域可以重叠,但复制后src内容会被更改。函数返回指向dest的指针。
原型:extern void setmem(void *buf, unsigned int count, char ch);
        
  用法:#include <string.h>
  
  功能:把buf所指内存区域前count个字节设置成字符ch。
  
  说明:返回指向buf的指针。
原型:extern char *stpcpy(char *dest,char *src);
        
  用法:#include <string.h>
  
  功能:把src所指由NULL结束的字符串复制到dest所指的数组中。
  
  说明:src和dest所指内存区域不可以重叠且dest必须有足够的空间来容纳src的字符串。
        返回指向dest结尾处字符(NULL)的指针。
原型:extern char *strcat(char *dest,char *src);
        
  用法:#include <string.h>
  
  功能:把src所指字符串添加到dest结尾处(覆盖dest结尾处的'\0')并添加'\0'。
  
  说明:src和dest所指内存区域不可以重叠且dest必须有足够的空间来容纳src的字符串。
        返回指向dest的指针。
原型:extern char *strchr(char *s,char c);
        
  用法:#include <string.h>
  
  功能:查找字符串s中首次出现字符c的位置
  
  说明:返回首次出现c的位置的指针,如果s中不存在c则返回NULL。
原型:extern int strcmp(char *s1,char * s2);
        
  用法:#include <string.h>
  
  功能:比较字符串s1和s2。
  
  说明:
        当s1<s2时,返回值<0
        当s1=s2时,返回值=0
        当s1>s2时,返回值>0
原型:extern int stricmp(char *s1,char * s2);
        
  用法:#include <string.h>
  
  功能:比较字符串s1和s2,但不区分字母的大小写。
  
  说明:strcmpi是到stricmp的宏定义,实际未提供此函数。
        当s1<s2时,返回值<0
        当s1=s2时,返回值=0
        当s1>s2时,返回值>0
原型:extern char *strcpy(char *dest,char *src);
        
  用法:#include <string.h>
  
  功能:把src所指由NULL结束的字符串复制到dest所指的数组中。
  
  说明:src和dest所指内存区域不可以重叠且dest必须有足够的空间来容纳src的字符串。
        返回指向dest的指针。
原型:extern int strcspn(char *s1,char *s2);
        
  用法:#include <string.h>
  
  功能:在字符串s1中搜寻s2中所出现的字符。
  
  说明:返回第一个出现的字符在s1中的下标值,亦即在s1中出现而s2中没有出现的子串的长度。
原型:extern char *strdup(char *s);
        
  用法:#include <string.h>
  
  功能:复制字符串s
  
  说明:返回指向被复制的字符串的指针,所需空间由malloc()分配且可以由free()释放。
原型:extern int stricmp(char *s1,char * s2);
        
  用法:#include <string.h>
  
  功能:比较字符串s1和s2,但不区分字母的大小写。
  
  说明:strcmpi是到stricmp的宏定义,实际未提供此函数。
        当s1<s2时,返回值<0
        当s1=s2时,返回值=0
        当s1>s2时,返回值>0
原型:extern int strlen(char *s);
        
  用法:#include <string.h>
  
  功能:计算字符串s的长度
  
  说明:返回s的长度,不包括结束符NULL。
原型:extern char *strlwr(char *s);
        
  用法:#include <string.h>
  
  功能:将字符串s转换为小写形式
  
  说明:只转换s中出现的大写字母,不改变其它字符。返回指向s的指针。
原型:extern char *strncat(char *dest,char *src,int n);
        
  用法:#include <string.h>
  
  功能:把src所指字符串的前n个字符添加到dest结尾处(覆盖dest结尾处的'\0')并添加'\0'。
  
  说明:src和dest所指内存区域不可以重叠且dest必须有足够的空间来容纳src的字符串。
        返回指向dest的指针。
原型:extern int strcmp(char *s1,char * s2,int n);
        
  用法:#include <string.h>
  
  功能:比较字符串s1和s2的前n个字符。
  
  说明:
        当s1<s2时,返回值<0
        当s1=s2时,返回值=0
        当s1>s2时,返回值>0
原型:extern int strnicmp(char *s1,char * s2,int n);
        
  用法:#include <string.h>
  
  功能:比较字符串s1和s2的前n个字符但不区分大小写。
  
  说明:strncmpi是到strnicmp的宏定义
        当s1<s2时,返回值<0
        当s1=s2时,返回值=0
        当s1>s2时,返回值>0
原型:extern char *strpbrk(char *s1, char *s2);
        
  用法:#include <string.h>
  
  功能:在字符串s1中寻找字符串s2中任何一个字符相匹配的第一个字符的位置,空字符NULL不包括在内。
  
  说明:返回指向s1中第一个相匹配的字符的指针,如果没有匹配字符则返回空指针NULL。

 

原型:extern char *strrev(char *s);
        
  用法:#include <string.h>
  
  功能:把字符串s的所有字符的顺序颠倒过来(不包括空字符NULL)。
  
  说明:返回指向颠倒顺序后的字符串指针。
原型:extern char *strset(char *s, char c);
        
  用法:#include <string.h>
  
  功能:把字符串s中的所有字符都设置成字符c。
  
  说明:返回指向s的指针。
原型:extern char *strstr(char *haystack, char *needle);
        
  用法:#include <string.h>
  
  功能:从字符串haystack中寻找needle第一次出现的位置(不比较结束符NULL)。
  
  说明:返回指向第一次出现needle位置的指针,如果没找到则返回NULL。
原型:extern char *strtok(char *s, char *delim);
        
  用法:#include <string.h>
  
  功能:分解字符串为一组标记串。s为要分解的字符串,delim为分隔符字符串。
  
  说明:首次调用时,s必须指向要分解的字符串,随后调用要把s设成NULL。
        strtok在s中查找包含在delim中的字符并用NULL('\0')来替换,直到找遍整个字符串。
        返回指向下一个标记串。当没有标记串时则返回空字符NULL。
原型:extern char *strupr(char *s);
        
  用法:#include <string.h>
  
  功能:将字符串s转换为大写形式
  
  说明:只转换s中出现的小写字母,不改变其它字符。返回指向s的指针。
  
posted on 2017-03-13 22:23  长风II  阅读(134)  评论(0编辑  收藏  举报