我使用了该strcpy()
函数,它仅在我使用 C 字符串数组时才有效,例如:
char a[6] = "text";
char b[6] = "image";
strcpy(a,b);
但每当我使用
string a = "text";
string b = "image";
strcpy(a,b);
我收到此错误:
functions.cpp:没有匹配的函数调用
strcpy(std::string&, std::string&)
如何在 C++ 中复制 2 个字符串数据类型的字符串?