home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!hal.com!decwrl!csus.edu!news
- From: eps@futon.SFSU.EDU (Eric P. Scott)
- Newsgroups: comp.sys.next.programmer
- Subject: Re: Can I pass variables to system()?
- Message-ID: <1992Sep4.082118.17128@csus.edu>
- Date: 4 Sep 92 08:21:18 GMT
- References: <21376@optima.cs.arizona.edu>
- Sender: news@csus.edu
- Reply-To: eps@cs.sfsu.edu
- Organization: San Francisco State University
- Lines: 15
-
- In article <21376@optima.cs.arizona.edu> kline@cs.arizona.edu
- (Nick Kline) writes:
- > sprintf(string,"cal %d %d > /tmp/calOutputFile",theMonth,theYear);
- > system(string);
-
- The general rule on any UNIX system (this is not NeXT-specific)
- is that you want to prefix a simple external command with an
- "exec" verb to avoid having an extraneous shell process lying
- around, i.e.:
-
- sprintf(string,"exec cal %d %d > /tmp/calOutputFile",theMonth,theYear);
-
- -=EPS=-
- --
- Try system("ps -t"); system("exec ps -t"); to see the difference.
-