what am I doing wrong?
Nathan Myers
ncm@cygnus.com
Thu Oct 29 00:24:00 GMT 1998
> I'm trying to install and use the 2.90.1 snapshot, purely because the
> [io]streambuf_iterators are implemented, on a Solaris 2.6 system using egcs
> 1.1. Downloaded the library today and it built okay, but I never got as far
> as linking against the resulting files.
That snapshot isn't really intended for use, just for inspection.
> The idea is to
> quickly and completely portably copy a file, so what I want, ideally, is
>
> // given an ifstream& IN and ofstream& OUT for this email
> copy (istreambuf_iterator (IN),
> istreambuf_iterator (),
> ostreambuf_iterator (OUT));
>
> I know there are only about a million ways to copy a file "completely
> portably" in C++, but I was hoping for something short and elegant. :-)
The most elegant way I know of to copy a file is
OUT << IN.rdbuf();
Nathan Myers
ncm@cantrip.org
More information about the Libstdc++
mailing list