www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/01/26/07:31:56

Date: Wed, 26 Jan 2000 14:21:50 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp-workers AT delorie DOT com
Subject: Re: libstdc++ [io]fstream cannot open file in binary mode (g++ and egcs) (fwd)
Message-ID: <Pine.SUN.3.91.1000126142108.6180I-100000@is>
MIME-Version: 1.0
X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by delorie.com id HAA13866
Reply-To: djgpp-workers AT delorie DOT com

Andris, this might be worth adding for the next GCC release (unless 
libstdc++ is corrected by then).

---------- Forwarded message ----------
Date: Wed, 26 Jan 2000 09:51:24 +0100
From: Martin v. Loewis <martin AT loewis DOT home DOT cs DOT tu-berlin DOT de>
To: uue AT pauzner2 DOT dnttm DOT rssi DOT ru
Cc: gcc-bugs AT gcc DOT gnu DOT org
Subject: Re: libstdc++ [io]fstream cannot open file in binary mode (g++ and egcs)

> I can not open fstream in BINARY mode,

Thanks for your bug report. Here is a patch.

Is that ok for the release branch as well?

Martin

2000-01-26  Martin v. Löwis  <loewis AT informatik DOT hu-berlin DOT de>

	* fstream.h (ifstream::ifstream): Add ios::in to mode.
	(ifstream::open): Likewise.
	(ofstream::ofstream): Add ios::out to mode.
	(ofstream::open): Likewise.

Index: fstream.h
===================================================================
RCS file: /cvs/gcc/egcs/libio/fstream.h,v
retrieving revision 1.2
diff -u -p -r1.2 fstream.h
--- fstream.h	1999/09/04 15:08:50	1.2
+++ fstream.h	2000/01/26 07:53:50
@@ -1,5 +1,5 @@
 /* This is part of libio/iostream, providing -*- C++ -*- input/output.
-Copyright (C) 1993 Free Software Foundation
+Copyright (C) 1993, 2000 Free Software Foundation
 
 This file is part of the GNU IO Library.  This library is free
 software; you can redistribute it and/or modify it under the
@@ -62,9 +62,9 @@ class ifstream : public fstreambase, pub
     ifstream(int fd) : fstreambase(fd) { }
     ifstream(int fd, char *p, int l) : fstreambase(fd, p, l) { } /*Deprecated*/
     ifstream(const char *name, int mode=ios::in, int prot=0664)
-	: fstreambase(name, mode, prot) { }
+	: fstreambase(name, mode | ios::in, prot) { }
     void open(const char *name, int mode=ios::in, int prot=0664)
-	{ fstreambase::open(name, mode, prot); }
+	{ fstreambase::open(name, mode | ios::in, prot); }
 };
 
 class ofstream : public fstreambase, public ostream {
@@ -73,9 +73,9 @@ class ofstream : public fstreambase, pub
     ofstream(int fd) : fstreambase(fd) { }
     ofstream(int fd, char *p, int l) : fstreambase(fd, p, l) { } /*Deprecated*/
     ofstream(const char *name, int mode=ios::out, int prot=0664)
-	: fstreambase(name, mode, prot) { }
+	: fstreambase(name, mode | ios::out, prot) { }
     void open(const char *name, int mode=ios::out, int prot=0664)
-	{ fstreambase::open(name, mode, prot); }
+	{ fstreambase::open(name, mode | ios::out, prot); }
 };
 
 class fstream : public fstreambase, public iostream {

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019