This is the mail archive of the libstdc++@sources.redhat.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bug ofstream and ios::trunc


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]