Xref: utzoo comp.lang.c:27307 comp.sys.ibm.pc.programmer:627 Path: utzoo!utgpu!watserv1!watmath!maytag!xenitec!timk From: timk@xenitec.on.ca (Tim Kuehn) Newsgroups: comp.lang.c,comp.sys.ibm.pc.programmer Subject: Turbo C "system" question Message-ID: <1990Mar28.195044.15297@xenitec.on.ca> Date: 28 Mar 90 19:50:44 GMT Reply-To: timk@xenitec.UUCP (Tim Kuehn) Distribution: na Organization: TDK Consulting Services, Kitchener, ON, Canada Lines: 33 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 #include 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@xenitec.on.ca !watmath!maytag!xenitec!timk No disclaimer here - I *am* the company! ------------------------------------------------------------------------------