Redirecting STDOUT using spawn
Bob Stout
Bob.Stout at p6.f506.n106.z1.fidonet.org
Thu Feb 22 00:28:23 AEST 1990
In an article of <19 Feb 90 20:42:36 GMT>, (owen adair) writes:
>How do I redirect stdout for a child process using spawn instead of
>system? I wan tthe return codes that are available using spawn but you
>cant pass the "> filename" stuff using spawn ..... Also, I need STDOUT to
>return to normal...
First of all, since you're using spawn rather than fork, I'll assume you're
using DOS and answer accordingly, although the same techniques apply and the
essential function is ANSI...
freopen("FILE", "w", stdout);
ercode = spawnlp(P_WAIT, "PROG.EXE", "PROG", "ARGS", NULL);
freopen("CON", "w", stdout);
More information about the Comp.lang.c
mailing list