Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!ncrcom!ncratl!tmeiners From: tmeiners@ncratl.AtlantaGA.NCR.COM (Tedd Meinersmann) Newsgroups: comp.os.os2.programmer Subject: '.cmd' return codes Message-ID: <18503@ncratl.AtlantaGA.NCR.COM> Date: 10 Apr 91 20:58:54 GMT Distribution: comp Organization: NCR Engineering and Manufacturing Atlanta -- Atlanta, GA Lines: 28 I would like to get a return code from a executable file (.cmd or .exe) when I execute the file from within my 'C' code. On a Unix system, this is not a problem since '/bin/sh' will return the status of the last command executed or the return code given with a shell 'exit' command. For OS/2 (MicroSoft C 6.0) 'cmd.exe' does not return an exit status of the '.cmd' or '.exe' file that it executed. There is no 'exit' equivalent of '.cmd' programming to force a return code. Another problem (I think, but am not 100% sure of) is that the 'system' procedure return a zero if the 'cmd.exe' is executed successfully and non-zero if it isn't. It does not return the return code it gets from 'cmd.exe' from the 'DosWait' procedure. Does anyone have any ideas on how to overcome this problem? Kludge solutions include (the child process being executed) writing to a file, shared memory, pipe, semaphore, etc. and have the parent check that output after the child is complete. Anything better???? -- Tedd.Meinersmann@AtlantaGA.NCR.COM (404)-623-7349 2651 Satellite Blvd. Duluth, GA 30136