Article View: comp.sys.next.programmer
Article #1092Re: Can I pass variables to system()?
From: Eric P. Scott
Date: Fri, 04 Sep 1992 08:21
Date: Fri, 04 Sep 1992 08:21
15 lines
965 bytes
965 bytes
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.
Technical Details
Message-ID:
<1992Sep4.082118.17128@csus.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!olivea!hal.com!decwrl!csus.edu!newsReferences:
<21376@optima.cs.arizona.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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