Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!mcsun!hp4nl!ahds!dick From: dick@ahds.UUCP (Dick Heijne CCS/TS) Newsgroups: comp.unix.misc Subject: Re: system cmmand Keywords: system sh Message-ID: <1980@ahds.UUCP> Date: 24 Apr 91 09:46:32 GMT Article-I.D.: ahds.1980 References: <1628@babcock.cerc.wvu.wvnet.edu> Organization: Ahold NV, Zaandam, Netherlands, EEC Lines: 23 In article <1628@babcock.cerc.wvu.wvnet.edu>, abmg@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.