This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: bug ofstream and ios::trunc
- To: peeterj at ca dot ibm dot com
- Subject: Re: bug ofstream and ios::trunc
- From: brent at rcfile dot org
- Date: Mon, 2 Oct 2000 01:27:20 -0400
- Cc: stdc++ <libstdc++ at sourceware dot cygnus dot com>
- References: <OF22EC1C7C.98363FBB-ON85256967.001490A7@torolab.ibm.com>
On 27 Sep 2000 at 00:01 (-0400), peeterj@ca.ibm.com wrote:
| Hi,
Hi,
The expeced results are produced from your examples using the
latest cvs g++/libstdc++-v3.
| Using both gcc-2.95.2/lib/gcc-lib/powerpc-ibm-aix4.3.2.0 and
| i386-redhat-linux/egcs-2.91.66 I am seeing that when ios::trunc is
| specified in the ofstream constructor mode parameter, no output is ever
| generated, as the following small samples illustrate.
|
| /* no_output.cc */
| #include <fstream.h>
| int main()
| {
| ofstream f("blah", ios::trunc);
| f << "hi\n";
| return 0;
| }
/* your example corrected for use with libstdc++v3 */
/* no_output.cc */
#include <fstream>
int
main()
{
std::ofstream f("blah", std::ios::trunc);
f << "hi\n";
return 0;
}
similar changes were made to the following example as well...
| vs.
|
| /* gives_output.cc */
| #include <fstream.h>
| int main()
| {
| ofstream f("blah");
| f << "hi\n";
| return 0;
| }
cheers,
brent
--
All opinions expressed are My own, unless otherwise attributed. In
presenting facts, I expressly reserve the right to be Wrong. Portions
of this message authored by Me are subject to the Free Thought License.