system cmmand
Dick Heijne CCS/TS
dick at ahds.UUCP
Wed Apr 24 19:46:32 AEST 1991
In article <1628 at babcock.cerc.wvu.wvnet.edu>, abmg at cathedral.cerc.wvu.wvnet.edu (Aliasghar Babadi) writes:
> Hi,
>
> I run a program using the system command similar to the following
>
> system("prog &");
>
> for some programs I lose the stdin inputs. For some others get
> a lots of stdin input. What am I doing wrong? thanks in advance.
See User Manual (SysV): sh(1) or (Xenix): sh(C) approx. pp. 9:
" If a command is followed by & the default standard input for
the command is the empty file /dev/null. Otherwise, the
environment for the execution of a command contains the file
descriptors of the invoking shell etc....."
Remember that system(3C) does a "sh -c" to do it's job, so rules apply
to sh(1).
This explains situations where you don't get stdin input at all.
Situations where you get lots(???) of stdin input must be explainable
by the way the argument to system() is formatted.
Dick.
More information about the Comp.unix.misc
mailing list