}
@函数名称: strlwr
函数原型: char *strlwr(char *s)
函数功能: 将字符串中的字符变为小写字符
函数返回: 指向s的指针
参数说明:
所属文件: <string.h>
#include<string.h>
int main()
{
char str[]="HOW TO SAY?";
printf("%s",strlwr(str));
return 0;
}
@函数名称: strlen
函数原型: unsigned int strlen(char * str);
函数功能: 统计字符串str中字符的个数(不包括终止符'\0')
函数返回: 返回字符串的长度.
参数说明:
所属文件: <string.h>
#include <stdio.h>
#include<string.h>
int main()
{
char str[]="how are you!";
printf("the lence is:%d\n",strlen(str));
return 0;
}
@函数名称: strerror
函数原型: char *strerror(int errnum)
函数功能: 得到错误信息的内容信息
函数返回: 错误提示信息字符串指针
参数说明: errnum-错误编号
所属文件: <string.h>
#include <stdio.h>
#include <errno.h>
int main()
{
char *buffer;
buffer=strerror(errno);
printf("Error: %s",buffer);
return 0;
}
@函数名称: memcpy
函数原型: void *memcpy(void *dest, const void *src, size_t n)
函数功能: 字符串拷贝
函数返回: 指向dest的指针
参数说明: src-源字符串,n-拷贝的最大长度
所属文件: <string.h>,<mem.h>
#include <stdio.h>
#include <string.h>
int main()
{
char src[]="******************************";
char dest[]="abcdefghijlkmnopqrstuvwxyz0123456709";
char *ptr;
printf("destination before memcpy:%s\n",dest);
ptr=memcpy(dest,src,strlen(src));
if (ptr)
printf("destination after memcpy:%s\n",dest);
else
printf("memcpy failed");
return 0;
}
@函数名称: memccpy
函数原型: void *memccpy(void *dest, const void *src, int c, size_t n)
函数功能: 字符串拷贝,到指定长度或遇到指定字符时停止拷贝
函数返回:
参数说明: src-源字符串指针,c-中止拷贝检查字符,n-长度,dest-拷贝底目的字符串指针
所属文件: <string.h>,<mem.h>
#include <string.h>
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-34103-6.html
有些不属于这个年龄的成熟
作为一名中国人必须有打仗的觉悟
我们也希望为他筹多点钱去治疗