This is the mail archive of the libstdc++@gcc.gnu.org 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]
Other format: [Raw text]

Re: redirecting cin


On Tue, Dec 11, 2001 at 11:59:00AM -0500, Andrew Sutton wrote:
> now, it seems that the issue is one of synchronization with stdin (used by 
> the parser to generate and read token streams). anyway, the redirection 
> happens at the streambuf layer. so, technically calls to cin >> foo will take 
> data from the open ifstream.
> 
> that's all well and good - at least i figured out how to do it, but i need 
> calls to fread( stdin, ... ) or read( 0, ... ) to take data from the open 
> ifstream.

Ah.  Then you need to be affecting the C side of things, instead of /
in addition to the C++ side.  The C library for your platform is unaware
of the redirection that's happening inside libstdc++, of course, so...

Hum.  Not certain of a good way to do this in 3.0.  For 3.1 you'll be able
to extract the file descriptor and/or the FILE* and/or something else,
and then use standard C library class on those.


Phil

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams


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