[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_CHECK_FILES on /dev/stdin
From: |
Andreas Schwab |
Subject: |
Re: AC_CHECK_FILES on /dev/stdin |
Date: |
Fri, 31 Mar 2006 11:52:03 +0200 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) |
David Fang <address@hidden> writes:
>> > To give a little more context for what I'm trying to do in C++
>> > (experimentally): I've discovered that std::ifstream foo("/dev/stdin")
>> > results in a file stream that works just like cin, likewise for stdout,
>> > etc... Just like in standard C, one could use stdin, stdout, stderr as
>> > FILE*, I'd like to do the equivalent with std::fstream's. (std::cin is a
>> > basic_istream, not type-equivalent to a basic_ifstream.)
>>
>> But basic_ifstream is a basic_istream.
>
> Sorry for the confusion, I meant that the need to be *identical*, not just
> derivable from the other, because I'm containing their objects (value),
> not references.
> struct foo { ifstream _stream; };
I think you are making a design bug. An iostream is generally not
copyable, so you should always using it via a reference.
Andreas.
--
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Re: AC_CHECK_FILES on /dev/stdin, J.T. Conklin, 2006/03/30