Append to the end of a Char array in C++

前端 未结 4 1747
我在风中等你
我在风中等你 2021-02-08 14:58

Is there a command that can append one array of char onto another? Something that would theoretically work like this:

//array1 has already been set to \"The dog         


        
4条回答
  •  再見小時候
    2021-02-08 15:17

    If your arrays are character arrays(which seems to be the case), You need a strcat().
    Your destination array should have enough space to accommodate the appended data though.

    In C++, You are much better off using std::string and then you can use std::string::append()

提交回复
热议问题