Connecting Tech Pros Worldwide Forums | Help | Site Map

Redirecting standard input for external application

Gerrit Hulleman
Guest
 
Posts: n/a
#1: Jul 22 '05
Is it possible to redirect the standard input for an external application?

Something like:
ifstream in (...);
std::streambufx oldbuf = cin.rdbuf(in.rdbuf());
system(...);
cin.rdbuf(oldbuf);

The proces must run another program where the input for this external
program is allready present in memory of the original proces.

Gerrit



John Harrison
Guest
 
Posts: n/a
#2: Jul 22 '05

re: Redirecting standard input for external application



"Gerrit Hulleman" <hulleman@lupus-delta.tmfweb.nl> wrote in message
news:4090a8c6$0$557$e4fe514c@news.xs4all.nl...[color=blue]
> Is it possible to redirect the standard input for an external application?
>
> Something like:
> ifstream in (...);
> std::streambufx oldbuf = cin.rdbuf(in.rdbuf());
> system(...);
> cin.rdbuf(oldbuf);
>
> The proces must run another program where the input for this external
> program is allready present in memory of the original proces.
>
> Gerrit
>[/color]

Not in standard C++, you certainly can do this on Unix and Windows but in
both cases you need to use non-standard OS-specific API calls. Ask on a
group dedicated to whatever operating system you are using.

john


Closed Thread