-1
我是C++的新手,我有點困惑/有不同的方式來檢查文本文件是否存在。如何檢查目錄中是否存在文件?
我創建一個文本文件:
ofstream myfile;
myfile.open("actFile.txt");
,我可以在目錄中看到。但是,我將如何使用它來查看它是否已經存在?
會這樣嗎?
ofstream myfile;
if (myfile.good())
{
// read, write
} else
{
myfile.open("actFile.txt");
}
什麼是平臺? –
看看這個帖子: http://stackoverflow.com/questions/3365182/how-to-search-the-computer-for-files-and-folders – macroland