Turbo C "system" question

Tim Kuehn timk at xenitec.on.ca
Thu Mar 29 05:50:44 AEST 1990


Recently I was working on a program that would at various junctures
run other programs using the 'system' command in Turbo C. The thing is, 
no matter what command I pass system, it always returns a '0', even if 
the command I'm telling it to run isn't anywhere to be found. Is this
a bug, undocumented feature, or some other unknown demon of the bytes?

Sample code:

#include <stdio.h>
#include <process.h>
 
main()
{
printf("----\n");
printf("call result = %d\n", system("1STICKS"));
}
-----
the program "STICKS" exists, and when I issue the call with that name, 
it works fine. When I run the code above, it comes back with 'bad command or 
file name' on the display (which is to be expected), but it also returns
a 0 as the call result. Does the 0 return value mean that it was able to 
start up command.com only, or should I look somewhere else to get 
my return values from the execution (or lack thereof) of the program?

Thanks in advance for any and all assistance.

------------------------------------------------------------------------------
Timothy D. Kuehn 				TDK Consulting Services
871 Victoria St. North, Kitchener, 		voice: (519)-741-3623
Ontario, Canada N2B 3S4			 	DOS/Xenix - SW/HW. uC uP RDBMS
timk at xenitec.on.ca				!watmath!maytag!xenitec!timk
No disclaimer here - I *am* the company!
------------------------------------------------------------------------------



More information about the Comp.lang.c mailing list