easy, basic, question...

Michael R. Wolfe wolfe at neon.stanford.edu
Sat Aug 19 05:32:27 AEST 1989



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



More information about the Comp.unix.questions mailing list