Redirecting standard input for external application

G

Gerrit Hulleman

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
 
J

John Harrison

Gerrit Hulleman said:
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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top