Subject: pipes and spawn
From: [email-masked] (Craig Setera)

29 May 1998 18:27:11 -0700
Message-ID: <5010400023382884000002L042*.cygnus.gnu-win32@MHS>
Mime-Version: 1.0
Content-Type: text/plain
To: <[email-masked]>

I'm trying to use the spawn family of calls to kick off a child process and then
have them communicate through pipes, but that does not seem to work.  For
instance (from memory... maybe not perfect):

int in[1], out[2];
int pid;
char *args[3];

pipe(in);
pipe(out);
args[0] = (char *) malloc (50);
strcpy(args[0], "/some/program/name");
args[1] = (char *) malloc (10);
sprintf(args[1], "%d", in[1]);
args[2] = (char *) malloc (10);
sprintf(args[2], "%d", out[0]);
pid = spawnv(P_NOWAIT, args[0], args);

This does not seem to work correctly and I'm not sure why.  It is as if the
pipe is
not open or something.  Can anyone offer any insights or samples?

Thanks,
Craig

Craig Setera
AS/400 Enterprise Java Development
IBM Rochester
[email-masked]
(507) 253-3387 - Tie: 553-3387
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".