[comp.sys.ibm.pc.programmer] Redirecting STDOUT using spawn

peter@ficc.uu.net (Peter da Silva) (02/24/90)

>         freopen("FILE", "w", stdout);
>         ercode = spawnlp(P_WAIT, "PROG.EXE", "PROG", "ARGS", NULL);
>         freopen("CON", "w", stdout); 

Let me be the first of no doubt many people to point out that this does not
redirect stdin back to normal. If the program you were running was already
redirected, that redirection will be lost.

To really do this right you need to use a lower-level routine. Observe
followups...
-- 
 _--_|\  Peter da Silva. +1 713 274 5180. <peter@ficc.uu.net>.
/      \
\_.--._/ Xenix Support -- it's not just a job, it's an adventure!
      v  "Have you hugged your wolf today?" `-_-'