std:: strcat
| Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
| 
 | |||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
| 
 | |||||||||||||||||||||||||
| Functions | ||||||||||||||||||||||||||||||||||||
| Character classification | ||||||||||||||||||||||||||||||||||||
| Character manipulation | ||||||||||||||||||||||||||||||||||||
| Conversions to numeric formats | ||||||||||||||||||||||||||||||||||||
| 
 | 
 | |||||||||||||||||||||||||||||||||||
| String manipulation | ||||||||||||||||||||||||||||||||||||
| 
 | ||||||||||||||||||||||||||||||||||||
| String examination | ||||||||||||||||||||||||||||||||||||
| Character array functions | ||||||||||||||||||||||||||||||||||||
| Miscellaneous | ||||||||||||||||||||||||||||||||||||
| 
           定义于头文件
            
            
             <cstring>
            
            | ||
| 
           
            
             char
            
            
             *
            
            strcat
            
             (
            
            
             char
            
            
             *
            
            dest,
            
             const
            
            
             char
            
            
             *
            
            src
            
             )
            
            
             ;
            
           
           | ||
将 src 所指向的字符串副本追加到 dest 所指向字符串的末尾。字符 src [ 0 ] 将替换 dest 末尾的空终止符。最终生成的字节字符串以空字符结尾。
如果目标数组的大小不足以容纳 src 和 dest 的内容以及终止空字符,则行为是未定义的。
如果字符串重叠,则行为未定义。
| 目录 | 
参数
| dest | - | 指向要追加到的以空字符结尾的字节字符串的指针 | 
| src | - | 指向要复制的以空字符结尾的字节字符串的指针 | 
返回值
dest
注释
       由于
       
        strcat
       
       在每次调用时都需要定位到
       
        
         dest
        
       
       的末尾,因此使用
       
        strcat
       
       将多个字符串连接成一个字符串的效率较低。
      
示例
#include <cstdio> #include <cstring> 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!
参见
| 将两个字符串的指定数量字符进行拼接 (函数) | |
| 将一个字符串复制到另一个字符串 (函数) | |
| 
          
           
            C 文档
           
          
          关于
          
           
            strcat
           
          
          | |