ios::trunc error?

Daniel X. Pape dpape@canis.uiuc.edu
Thu Dec 10 01:45:00 GMT 1998


Stats:

gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
Red Hat Linux release 5.2 (Apollo)
Kernel 2.1.125 on an i686
My machine has 2 450mHz PII processors, 256MB RAM...

------

Shouldn't the following code produce two files with a '5' in them? (The
two files did not previously exist)

The second file comes up empty on my machine...


------
#include <fstream>
int main(void) {
    ofstream f1("one.out");
    ofstream f2("two.out", ios::trunc);
    f1 << 5 << endl;
    f2 << 5 << endl;
    return 0;
}
------


Thanks - 


Dan





More information about the Gcc-bugs mailing list