This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: bug in istream.get(b,c,d) ?
- From: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Wed, 18 Sep 2002 18:33:59 -0500 (CDT)
- Subject: Re: bug in istream.get(b,c,d) ?
- Organization: Networks and Infrastructure Lab (IL02/2240), Motorola Labs
- References: <200209182230.g8IMUgt9052771@latour.rsch.comm.mot.com>
>> Consider (line at a time version of cat
>> which alway adds a final newline if not present):
> Or even easier and more efficient:
> #include <iostream>
> #include <fstream>
>
> int main (int argc, char *argv[])
> {
> for (int i = 1; i < argc; ++i)
> std::cout << std::ifstream (argv [i], std::ios::in).rdbuf ();
> }
OK, most agreed. However, I did retain the assumption that he wanted
visibility into "line at a time" instead of block processing. ;-)
For absolute maximal efficiency on all libstdc++-v3 ports, also add
this line (to either example):
std::ios::sync_with_stdio (false);
BTW, although it may appear otherwise in this e-mail, I would never
challenge Martin to an optimization contest.
Regards,
Loren