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

ifstream problems on fbsd-4.0


Argh,

I'm seeing a problem with ifstream under freebsd 4.0 -- or 
_I_ think, streambuf. the following prog works as expected 
under linux (using libstdc++/g++ compiled from same sources). 
I have spent all of this friday evening looking for a solution, 
but I'm not good enough to solve it :), so I'm punting and 
making a bug report.

#include <fstream>
int
main(int argc, char** argv)
{
  std::ifstream  in(argv[1]);
  std::ofstream out(argv[2]);
  out << in.rdbuf();
  return 0;
}

The output below is from a script that creates files of
known size to run through the prog above; the first
two colums are sizes of the file(s), the third is the
difference in size... blah. What is interesting is that
after _M_buf is larger than _M_buf_size, it all gets
screwy (that's about as technical as I can safely get,
even after an evening in the code :) I suspect that 
_M_in_end is not set or that eof() is missed somehow.

     Input    Output     I - O
------------------------------
       200       200         0
       400       400         0
       600       600         0
       800       800         0
      1000      1000         0
      1200      2048      -848
      1400      2048      -648
      1600      2048      -448
      1800      2048      -248
      2000      2048       -48
      2200      3072      -872
      2400      3072      -672
      2600      3072      -472

When the solution to this is uncovered, would the
solver please let me know _specifically_ what was
broken (so I don't feel like I _wasted_ a perfectly
good friday night, plus I'd actually like to be
able to help the cause one day). If you need access
to the fbsd box, let me know -- if I recognize your
name from one of the lists, there is an account on
the box I can let you ssh into.

Thanks (and ... Heeellllpp!)
    Brent

-- 

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