连接字符串的函数
来源:互联网 发布:淘宝联系卖家客服 编辑:程序博客网 时间:2024/04/28 14:29
strcat(连接两字符串)
char *strcat (char *dest, const char *src );
strcat()会将参数src字符串拷贝到参数dest所指的字符串尾。第一个参数dest要有足够的空间来容纳要拷贝的字符串。该函数返回参数dest的字符串起始地址(strcat函数要求dest参数原先已经包含了一个字符串,该字符串可以是空字符串。它找到这个字符串的末尾,并把src字符串的一份拷贝添加到这个位置。如果src和dest的位置发生重叠,其结果是未定义的)。
strncat(连接两字符串)
char * strncat( char *dest, const char *src, size_t n );
strncat()会将参数src字符串拷贝n个字符到参数dest所指的字符串尾。第一个参数dest要有足够的空间来容纳要拷贝的字符串。该函数返回参数dest的字符串起始地址。
#include<stdio.h>
#include<string.h>
int main()
{
//strcat
char a[30]="string1ABCDE";
char b[]="STRING2";
printf( "before strcat() : %s/n",a );
printf( "after strcat() : %s/n",strcat( a, b ) );
//strncat
char a1[30]="string1";
char b1[]="STRING2";
printf( "before strnact(): %s/n", a1 );
printf( "after strncat() : %s/n", strncat( a1, b1, 6 ) );
getchar();
return 0;
}
- 连接字符串的函数
- 简洁的字符串连接函数
- 字符串连接函数的实现
- C语言的连接字符串函数
- 字符串连接(strcat)的函数
- mysql 连接字符串的函数使用
- sQL 连接字符串 函数
- sql字符串连接函数
- mysql字符串连接函数
- 字符串分解连接函数
- mysql字符串连接函数
- mysql字符串连接函数
- mysql字符串连接函数
- MySQL字符串连接函数
- 连接字符串strcat()函数
- 字符串连接函数
- MySQL字符串连接函数
- MySQL字符串连接函数
- 总线错误和段错误相关概念
- const与数组声明
- 字符串拷贝和内存拷贝函数
- 字符串和内存数据比较函数
- 读《沉思录》后,与师妹的对答—— 所说并非自己所能做到,只是见解。说和做不是直接对等关系
- 连接字符串的函数
- myeclipse 修改项目名称
- 查找字符/字符串的函数
- 什么是标准预定义宏
- 断言 assert(表达式) 相关概念
- Autoit v3的介绍
- Typedef相关概念
- 2009年度“IT新锐书”评选,免费领取购书卡!
- = 不同于 ==