Re: best way of copy istream to ostream

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Pete Becker wrote:
bg wrote:

hi all,

what the best (stl) way of copy input to output using ofstreams/ifstreams


Depends on what you mean by that "(stl)" constraint. If you mean Standard Template Library, then maybe:

copy(istream_iterator<unsigned char>(input), istream_iterator<unsigned char.(), ostream_iterator<unsigned char>(output, ""));

Don't you mean:
copy(
istreambuf_iterator<char>(input),
istreambuf_iterator<char>(),
ostreambuf_iterator<char>(output)
);

Tom
.



Relevant Pages

  • best way of copy istream to ostream
    ... what the best (stl) way of copy input to output using ofstreams/ifstreams ... This strikes me as rather clunky and inelegant, there must be a better way, ...
    (microsoft.public.vc.stl)
  • Re: Learning C++
    ... Jeremy Cowles wrote: ... > STL? ... Pete Becker ... Dinkumware, Ltd. ...
    (comp.lang.cpp)