
Daniel Eiband wrote:
Hi, I'm using Boost 1.42.0 and I have the same problem like vandamme described in this post at the end:
http://groups.google.com/group/boost-list/browse_thread/thread/c290c987bf1fa...
The following code will assert if the file "test" does not exist:
std::string filename("test"); boost::iostreams::streamboost::iostreams::file_source file;
file.open(filename.c_str()); if (file.is_open()) { // assert fires if file "test" does not exist assert(boost::filesystem::exists(filename)); }
The indirect_streambuf doesn't check the device and just returns true if open has been called (independent of whether open has been successful).
If I use the std::ifstream supplied with MSVC 9.0 is_open() returns false if the file does not exits. Checked by replacing file declaration with:
std::ifstream file;
Is this a bug? If not how can I test whether opening the stream succeeds?
I think you should file a bug. This can't be the intended behavior. Regards, Roland