RFA: libstdc++-v3: Support opening files in append read/write mode

Nick Clifton nickc@redhat.com
Tue Jul 29 07:21:00 GMT 2003


Hi Guys,

  Please may I have permission to apply the following patch ?  It
  allows files to be opened with a mode of (ios_base::in |
  ios_base::out | ios_base::app) which translates into an fopen() call
  with a mode of "a+".

Cheers
        Nick

2003-07-29  Nick Clifton  <nickc@redhat.com>

	* config/io/basic_file_stdio.cc (__basic_file::_M_open_mode): Open
	with "a+" if (ios_base::in | ios_base::out | ios_base::app) is
	used as the mode.

Index: libstdc++-v3/config/io/basic_file_stdio.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/io/basic_file_stdio.cc,v
retrieving revision 1.17
diff -c -3 -p -r1.17 basic_file_stdio.cc
*** libstdc++-v3/config/io/basic_file_stdio.cc	14 Jul 2003 18:23:12 -0000	1.17
--- libstdc++-v3/config/io/basic_file_stdio.cc	29 Jul 2003 07:18:27 -0000
*************** namespace std 
*** 94,99 ****
--- 94,104 ----
  	strcpy(__c_mode, "a");
  	__p_mode |=  O_WRONLY | O_CREAT | O_APPEND;
        }
+     if (__testi && __testo && !__testt && __testa)
+       {
+ 	strcpy(__c_mode, "a+");
+ 	__p_mode |=  O_CREAT | O_APPEND;
+       }
      if (!__testi && __testo && __testt && !__testa)
        {
  	strcpy(__c_mode, "w");
  



More information about the Gcc-patches mailing list