🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.os2.programmer
2 messages
2 total messages Started by Tedd Meinersmann Wed, 10 Apr 1991 20:58
'.cmd' return codes
#2527
Author: Tedd Meinersmann
Date: Wed, 10 Apr 1991 20:58
28 lines
1540 bytes
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
Re: '.cmd' return codes
#2534
Author: Peter Forsberg
Date: Thu, 11 Apr 1991 21:14
24 lines
1718 bytes
In article <18503@ncratl.AtlantaGA.NCR.COM> tmeiners@ncratl.AtlantaGA.NCR.COM (Tedd Meinersmann) writes:

   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.

   [Text deleted]

If you want to execute .EXE programs this is not a problem, use DosExecPgm
with the wait option (alternatively with no wait, using DosCWait to check
the exit status of the child). For .CMD files you should use DosStartSession,
but I don't remember exactly how you fetch the return code. DosStartSession
has a *VAST* amount of options that you can specify.

   -- 
   Tedd.Meinersmann@AtlantaGA.NCR.COM                           (404)-623-7349
   2651 Satellite Blvd.
   Duluth, GA  30136

Peter Forsberg  (RIT & IBM Sweden)
--
_______________________________________________________________________________
Peter Forsberg 		      Royal Institute of Technology, Stockholm, Sweden.
Internet: d88-pfo@nada.kth.se
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads