Re: [Boost-bugs] [Boost C++ Libraries] #3884: boost fstream 'enforces' in AND out mode. It should be be possible to open a read-only file using fstream.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3884: boost fstream 'enforces' in AND out mode. It should be be possible to open a read-only file using fstream.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-02-02 17:54:06


#3884: boost fstream 'enforces' in AND out mode. It should be be possible to open
a read-only file using fstream.
---------------------------------------------+------------------------------
 Reporter: Sachin Garg <schngrg@…> | Owner: bemandawes
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
  Version: Boost 1.41.0 | Severity: Problem
 Keywords: |
---------------------------------------------+------------------------------

Comment(by Sachin Garg <schngrg@…>):

 Replying to [comment:1 steven_watanabe]:
> If you know at compile time whether you are only going to read/write you
 should use ifstream or ofstream instead.

 File opening mode is decided at run-time and it workes fine when working
 with std::fstream objects (at least with Microsoft's implementation of it,
 didn't try on gcc).

 We also need a common base class to hold the open file stream objects
 (ifstream does not inherit from fstream, it's the other way round). If we
 use ifstream object when opening files only for reading, we won't be able
 to pass the object around with other fstream objects.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3884#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC