This is the mail archive of the
libstdc++-prs@sourceware.cygnus.com
mailing list for the libstdc++ project.
libstdc++/8: writing large strings to an ofstream causes stream to go bad
- To: libstdc++-gnats@sourceware.cygnus.com
- Subject: libstdc++/8: writing large strings to an ofstream causes stream to go bad
- From: dek@cgl.ucsf.edu
- Date: 7 Sep 1999 16:52:05 -0000
- Reply-To: dek@cgl.ucsf.edu
- Resent-Cc: libstdc++-prs@sourceware.cygnus.com,
- Resent-Reply-To: gnats-admin@sourceware.cygnus.com, dek@cgl.ucsf.edu
- Resent-To: nobody@sourceware.cygnus.com
>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: