【发布时间】:2014-02-17 03:50:11
【问题描述】:
int value = rand() % 1000;
string filelocation = "C:/Users/Admin/Documents/textfile"
string textfile = ".txt";
我怎样才能将它们加在一起并将其存储到另一个字符串变量中
例如
string test = "C:/Users/Admin/Documents/textfile123.txt"
这样我每次运行代码时都可以创建一个唯一的命名文本文件:
outfile.open(test, std::ios::app);
我试过了:
outfile.open("C:/Users/admin/Documents/textfile" + value + ".txt", std::ios::app);
但我收到错误'+' : cannot add two pointers
【问题讨论】:
标签: c++ string integer text-files filenames