ofstream problem: works in 2.96, failes in RH 9's 3.2.2-5
Jonathan Wakely
cow@compsoc.man.ac.uk
Wed Apr 30 10:48:00 GMT 2003
On Mon, Apr 28, 2003 at 08:20:12PM -0700, Ben Greear wrote:
> I have a LogStream class that inherits from ofstream. This code has worked
> for ages on RH 7.0 - RH 8 timeframes...and probably before. (I don't know
> the exact compiler versions...)
>
> However, it does not write anything to disk with the RH 9 g++ compiler,
> though it does create the file.
>
> Please let me know if you have any idea why. I am attaching my LogStream.h
> header and a small test program.
See the FAQ:
http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#4_4_iostreamclear
Calling std::ofstream::close() sets failbit, and std::ofstream::open()
doesn't clear it, so all subsequent writes fail.
jon
--
I eat my peas with honey, I've done it all my life
It makes them taste quite funny, but it keeps them on the knife
- The Orb
More information about the Libstdc++
mailing list