<p>In a C program (p1), how to launch a dynamically constructed command (and its arguments) that reads its standard input from p1's standard output?</p>

<p>Note that: </p>

<ol>
<li><p>A method other than this stdout -->
stdin piping is also OK <strong>provided</strong>
it is <strong>PORTABLE</strong> across Windows and
Linux.</p></li>
<li><p>I cannot use C++, Java, Perl, Ruby,
Python, etc here.</p></li>
</ol>

<p>Also, will this have a MinGW dependency for its Windows build?</p>

<p><strong>REOPENED</strong>: The question below answers it for Linux, but this question wants a portable method.
<a href="https://stackoverflow.com/questions/70842/execute-program-from-within-a-c-program">Execute program from within a C program</a></p>

It's not 100% clear to me what you're trying to achieve exactly to be honest.
But as I understand it, you could take a look at
Boost.Process
You can do things like
```
```
bp::child cs = p.start();
 bp::postream& os = cs.get_stdin();
```
```
And then use the
os
as any stream to dump stuff in the standard input of your child process.
Anyway, an awful lot can be achieved with the library w.r.t. pipe redirecting and chaining.