This is the mail archive of the libstdc++-prs@sourceware.cygnus.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]

libstdc++/8: writing large strings to an ofstream causes stream to go bad



>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:

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