我試圖刪除.txt
文件,但文件名存儲在std::string
類型的變量中。問題是,該程序不知道該文件的名稱預先所以我不能只用remove("filename.txt");
不存在從「std :: string」到「const char *」的合適轉換函數
string fileName2 = "loInt" + fileNumber + ".txt";
基本上就是我想要做的是:
remove(fileName2);
然而,它告訴我
No suitable conversion function from "std::string" to "const char *" exists.
關於remove()的信息:http://www.cplusplus.com/reference/cstdio/remove/ – iamantony 2016-05-17 12:29:14