65,186
社区成员




#include <iostream>
#include <cstring>
#include <cerrno> // This is included in <iostream>
using namespace std;
int main( )
{
/*
Joining Null-terminated Strings
*/
const size_t count{ 11 };
char str1[count]{"Many hands"};
const char* str2{ " make light work." };
errno_t error{ strcat_s(str1, str2) };
if (0 == error)
cout << "Strings joined successfully.\n"
<< str1 << endl;
else if (EINVAL == error)
cout << "Error! Source or destination string address is a null pointer."
<< endl;
else if (ERANGE == error)
cout << "Error! Destination string too small." << endl;
return 0;
}