Path: utzoo!mnetor!tmsoft!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!uunet!spool.mu.edu!sdd.hp.com!elroy.jpl.nasa.gov!jato!jdickson From: jdickson@jato.jpl.nasa.gov (Jeff Dickson) Newsgroups: comp.sys.amiga.programmer Subject: Re: C questions (again) Message-ID: <1991Feb7.224940.27921@jato.jpl.nasa.gov> Date: 7 Feb 91 22:49:40 GMT References: <1991Feb7.114348.10577@marlin.jcu.edu.au> Reply-To: jdickson@jato.Jpl.Nasa.Gov (Jeff Dickson) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 41 In article <1991Feb7.114348.10577@marlin.jcu.edu.au> glmwc@marlin.jcu.edu.au (Matt Crowd) writes: >Ok, I've just about given up after only getting 1 reply to the >problem with 2 programs not working with SAS 5.1 system() call. > >I've changed the programs around to this : (couldn't avoid >the Amiga specific code) > >Program1 : >#include >#include >#include > >struct DosBase *DosBase; > >main() >{ > struct FileHandle *input; > if(!(DosBase = (struct DosBase *) OpenLibrary("dos.library"))) > { > printf("Open lib failed.\n"); > exit(0); > } > input = (struct FileHandle *) Input(); // get filehandle of stdin > printf("This is program 1!\n"); > Execute("program2",input,0); // run program2 > printf("Because of something very wierd, this line " > "will not be printed. I do not know why.\n"); >} I remember something mentioned about Execute() being asynchronous. I think it was in some message that favorably compared it with System() under 2.0. It is not. When your program calls Execute(), it goes to sleep until Execute() is finished executing :-). It would be nice if an asynchro- nous form were available. I guess the only way now is to prefix the command string with "Run", but Execute() will return the result code of Run instead of the result code of the program you ran. If System() under version 2.0 is anything like the System() on UNIX systems - then no dice here either. >Colin Adams Jeff S. Dickson