Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!bionet!agate!shelby!neon!neon.stanford.edu!wolfe
From: wolfe@neon.stanford.edu (Michael R. Wolfe)
Newsgroups: comp.unix.questions
Subject: easy, basic, question...
Message-ID: <11072@neon.Stanford.EDU>
Date: 18 Aug 89 19:32:27 GMT
Sender: Michael R. Wolfe 
Reply-To: wolfe@neon.stanford.edu (Michael R. Wolfe)
Organization: Stanford University, Computer Science Dept.
Lines: 16



I know how to call Unix commands from C:  system(string), but
I'm having trouble coming up with the commands in string form
from inside of a program.  That is, I'm being forced to do
multiple strcat's to form a string to send to system.  Is there a
way around this?

In addition, is there any way to find the result of a unix command
called from C without having to send it to a file and then open
the file.  For example, I'm trying to use grep from C, which forces
me to make a string such as "grep file >> anotherfile" using strcat,
use "system" to call it, and then go and open "anotherfile" afterwards
to find the result.  Has anyone come up with a better way?

-Mike