#include<iostream>
#include<fstream>
int main()
{
std::string folderPath("./");
std::string fileFoo = folderPath + "";
std::string fileBar = folderPath + "nonexisting_file";
std::ifstream foo(fileFoo.c_str());
std::ifstream bar(fileBar.c_str());
std::cout << foo.good() << std::endl;
std::cout << bar.good() << std::endl;
}
出力:
1
0
- ストリーム ファイル パスがディレクトリであるとはどういう意味ですか。
fstream
この場合、読み取り可能であることを確認する方法good()
は機能しないためです。
編集:
これは関連しているようです:
プラットフォーム: Linux (Ubuntu 12.04)