delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/05/29/18:27:11

From: setera AT us DOT ibm DOT com (Craig Setera)
Subject: pipes and spawn
29 May 1998 18:27:11 -0700 :
Message-ID: <5010400023382884000002L042*.cygnus.gnu-win32@MHS>
Mime-Version: 1.0
To: <gnu-win32 AT cygnus DOT com>

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
setera AT us DOT ibm DOT com
(507) 253-3387 - Tie: 553-3387
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019