std::strcat
Defined in header <cstring> | | |
|---|---|---|
char *strcat( char *dest, const char *src ); | | |
所指向的字符串的副本。src所指向的字符串的末尾。dest.角色src[0]的末尾替换空终止符。dest产生的字节字符串为空终止。
如果目标数组不足以满足两个目标数组的内容,则该行为是未定义的。src和dest和终止空字符。
如果字符串重叠,则行为未定义。
参数
dest | - | pointer to the null-terminated byte string to append to |
|---|---|---|
src | - | pointer to the null-terminated byte string to copy from |
返回值
dest...
例
二次
#include <cstring>
#include <cstdio>
int main()
{
char str[50] = "Hello ";
char str2[50] = "World!";
std::strcat(str, str2);
std::strcat(str, " Goodbye World!");
std::puts(str);
}二次
产出:
二次
Hello World! Goodbye World!二次
另见
strncat | concatenates a certain amount of characters of two strings (function) |
|---|---|
strcpy | copies one string to another (function) |
c strcat文档
© cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

