[filesystem] Should fstream really 'force' in+out mode?
I want to open a read only file in ios::in mode using fstream but its open forces in+out mode, causing my open to fail when it could have succeeded. In boost::filesystem::fstream::open, the file open mode is modified to mode | std::ios_base::in | std::ios_base::out Is this really necessary or can this be changed in future? Atleast with MSVC 9.0, std::fstream isn't forcing such behavior. SG
On Thu, Aug 28, 2008 at 2:04 AM, Sachin Garg
I want to open a read only file in ios::in mode using fstream but its open forces in+out mode, causing my open to fail when it could have succeeded.
In boost::filesystem::fstream::open, the file open mode is modified to mode | std::ios_base::in | std::ios_base::out
Is this really necessary or can this be changed in future? Atleast with MSVC 9.0, std::fstream isn't forcing such behavior.
(Self replying) Maybe it should just use in+out as default parameters when user doesn't specifies any mode, instead of always modifying a user specified mode. SG
participants (1)
-
Sachin Garg