This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Equivalence table between C++ and C file open modes
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: Francesco Palagi <palagi at arcetri dot astro dot it>, libstdc++ at gcc dot gnu dot org, support <support at arcetri dot astro dot it>, Gianni Comoretto <comore at arcetri dot astro dot it>, Andrea Orlati <a dot orlati at ira dot inaf dot it>, Carlo Baffa <baffa at arcetri dot astro dot it>
- Date: Fri, 08 Jun 2007 15:01:45 +0200
- Subject: Re: Equivalence table between C++ and C file open modes
- References: <1181304985.5187.42.camel@palagi> <46695108.1030801@suse.de>
Paolo Carlini wrote:
I'm committing the below to mainline.
Actually, this version, which seems more clear and puts at the end the
lines new wrt C++03 (at some point we may add more...)
Paolo.
///////////
Index: fstream
===================================================================
--- fstream (revision 125496)
+++ fstream (working copy)
@@ -257,9 +257,30 @@
* Otherwise it tries to open the file named @a s using the flags
* given in @a mode.
*
- * [Table 92 gives the relation between openmode combinations and the
- * equivalent fopen() flags, but the table has not been copied yet.]
- */
+ * Table 92, adapted here, gives the relation between openmode
+ * combinations and the equivalent fopen() flags.
+ * (NB: lines in|out|app and binary|in|out|app per DR 596)
+ * +---------------------------------------------------------+
+ * | ios_base Flag combination stdio equivalent |
+ * |binary in out trunc app |
+ * +---------------------------------------------------------+
+ * | + "w" |
+ * | + + "a" |
+ * | + + "w" |
+ * | + "r" |
+ * | + + "r+" |
+ * | + + + "w+" |
+ * | + + + "a+" |
+ * +---------------------------------------------------------+
+ * | + + "wb" |
+ * | + + + "ab" |
+ * | + + + "wb" |
+ * | + + "rb" |
+ * | + + + "r+b" |
+ * | + + + + "w+b" |
+ * | + + + + "a+b" |
+ * +---------------------------------------------------------+
+ */
__filebuf_type*
open(const char* __s, ios_base::openmode __mode);