libstdc++/8: writing large strings to an ofstream causes stream to go bad
dek@cgl.ucsf.edu
dek@cgl.ucsf.edu
Tue Sep 7 09:57:00 GMT 1999
>Number: 8
>Category: libstdc++
>Synopsis: writing large strings to an ofstream causes stream to go bad
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Sep 07 09:57:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator: dek@cgl.ucsf.edu
>Release: libstdc++ 2.90 current CVS (as of Sept 6)
>Organization:
>Environment:
Mandrake Linux 6.0 w/ gcc-2.95
>Description:
Writing large (>5000 bytes) strings to an ofstream
causes the ofstream to go "bad".
>How-To-Repeat:
#include <string>
#include <fstream>
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);
}
>Fix:
? Perhaps an internal buffer is only 4k.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Libstdc++-prs
mailing list