Mail Archives: djgpp/1996/11/24/16:56:06
From: | elric AT wheel DOT dcn DOT davis DOT ca DOT us (Jeffrey Taylor)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | filebuf problem
|
Date: | 22 Nov 1996 19:40:54 GMT
|
Organization: | Davis Community Network - Davis, California, USA
|
Lines: | 22
|
Message-ID: | <574vk6$hr2@mark.ucdavis.edu>
|
NNTP-Posting-Host: | wheel.dcn.davis.ca.us
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I am trying to open a temporary scratch file for binary data in C++. I
do:
fstream file("name", ios::in | ios::out | ios:: trunc | ios:binary);
if (!file.rdbuf()->is_open())
fail code
It always fails. I think the problem is in the libio/filebuf.cc, line 109
which reads:
if (!(mode & (int)ios::nocreate) && !(mode & (int)ios::in))
posix_mode |= O_CREAT;
I think it should read:
if (!(mode & (int)ios::nocreate) && (mode & (int)ios::out) &&
(mode & (int)(ios::trunc | ios::app)))
posix_mode |= O_CREAT;
Someone want to give me a reality check on this?
Thanks,
Jeff T
- Raw text -