【发布时间】:2014-11-04 20:39:09
【问题描述】:
我正在尝试删除.txt 文件,但文件名存储在std::string 类型的变量中。问题是,程序事先不知道文件名,所以我不能只使用remove("filename.txt");
string fileName2 = "loInt" + fileNumber + ".txt";
基本上我想做的是:
remove(fileName2);
但是,它告诉我我不能使用它,因为它给了我错误:
不存在从“std::string”到“const char *”的合适转换函数。
【问题讨论】: