bug ofstream and ios::trunc
brent@rcfile.org
brent@rcfile.org
Sun Oct 1 22:23:00 GMT 2000
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.
More information about the Libstdc++
mailing list