-4
建立在Linux的一个空文件我想创建一个使用C的Ubuntu ++一个空文件,我尝试过很多办法,并不断失败,并显示此错误如何用C++
error: no matching function to 'std::basic_ofstream::open(std::cxxll::...
我的代码:
ifstream f(saltFile.c_str());
if (f.good())
{
cout << saltFile + " file already existed" << endl;
}
else
{
ofstream file;
file.open (saltFile, ios::out);
cout << saltFile << " created!" << endl;
}
(https://stackoverflow.com/questions/478075/creating-files-in-c) – Mureinik
'file.open(saltFile.c_str [在C++中创建的文件]的可能的复制( ),...'。 C++ 98版本只有一个'const char *'的原型:http://www.cplusplus.com/reference/fstream/ofstream/open/ – mch
您使用的是哪种编译器?你是否启用C++ 11或更高版本? – NathanOliver