Path: utzoo!attcan!uunet!samsung!usc!orion.oac.uci.edu!cerritos.edu!arizona.edu!arizona!dave From: dave@cs.arizona.edu (Dave P. Schaumann) Newsgroups: comp.sys.amiga.programmer Subject: Re: EXECUTE in C Message-ID: <652@caslon.cs.arizona.edu> Date: 13 Jan 91 03:35:38 GMT References: <1991Jan12.062506.19754@marlin.jcu.edu.au> Organization: U of Arizona CS Dept, Tucson Lines: 29 In article <1991Jan12.062506.19754@marlin.jcu.edu.au> zlnem@marlin.jcu.edu.au (N Milward) writes: > > I'm writing a C program that calls the 2 cli commands copy >and makedir. I'm using the call > status = Execute("copy ...",0,0); > and status = Execute("makedir ...",0,0); > > I was wondering if there was a way to return errors from the >copy and makedir command. Yes. First, create an argv[] vector for the call, just like the one available on entry to your program (assuming your running from a shell). Then, do this: if( (Comm_Found = fexecv( argv[0], argv )) == 0 ) Exit_Value = wait() ; fexecv() should be documented in your C manual. I was unable to find any documentation on wait(); I figured out how to do this by poking around in the source to Matt Dillon's shell (thanks, Matt). > Any help would be much appreciated. >Ross Milward - zlnem@marlin.jcu.edu.au Dave Schaumann | We've all got a mission in life, though we get into ruts; dave@cs.arizona.edu | some are the cogs on the wheels, others just plain nuts. -Daffy Duck.