This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: mailing list improvements and bug tracking database now online.
- To: Benjamin Kosnik <bkoz@cygnus.com>
- Subject: Re: mailing list improvements and bug tracking database now online.
- From: dek@cgl.ucsf.edu
- Date: Tue, 07 Sep 1999 09:54:41 -0700
- cc: libstdc++@sourceware.cygnus.com
- Reply-To: dek@cgl.ucsf.edu
OK, I posted my bug to the libstdc++ bug tracking system, but just to
make sure it gets to the right place, here it is as well.
"Writing large strings (>5000 bytes or so) to an ofstream causes
the stream to go bad."
Here is the test program which exposes the problem.
#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
const int i_max=250;
void test(int size)
{
int i;
string filename;
std::ofstream f("out.log");
std::cout << "Testing with size " << size << std::endl;
std::cout << "State of f:" << f.good() << std::endl;
string x(size, 'c');
f << x << endl;
std::cout << "State of f:" << f.good() << std::endl;
if (!f.good()) exit(1);
f << x << endl;
std::cout << "State of f:" << f.good() << std::endl;
if (!f.good()) exit(1);
f.close();
return;
}
int main()
{
test(1000);
test(10000);
}
On my system I get:
nano:~/src/TestStdC++
:./test7
Testing with size 1000
State of f:1
State of f:1
State of f:1
Testing with size 10000
State of f:1
State of f:0
Dave