strncpy的使用
#include<iostream>#include<cstring>
using namespace std;
int main()
{
const char *cp1="Mary hao";
const char *cp2="Lili hao";
size_t len=strlen(cp1)+strlen(cp2);
char *result_str=new char[len+1];
str3cpy(result_str,cp1);
strcat(result_str,cp2);
cout<<result_str<<endl;
delete [] result_str;
return 0;
}
大家帮忙看一下,错误在于strncpy怎么使用,谢谢了.