我使用了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个字符串数据类型的字符串?
https://stackoverflow.com/questions/12678819
复制相似问题