下面我在 char 数组中有两个变量存储
char one[7] = "130319";
char two[7] = "05A501";
我尝试用 stringstream 连接它们
std::ostringstream sz;
sz << one<< two;
之后我将其转换为字符串
std::string stringh = sz.str();
然后我尝试合并它以形成文件的路径并在该文件中写入文本
std::string start="d:/testingwinnet/json/";
std::string end= ".json";
std::string concat= start+stringh + end;
ofstream myfile(concat);
myfile << "test";
myfile.close();
我收到以下错误
error C2040: 'str' : 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' differs in levels of indirection from 'char *
任何想法。非常感谢