Thursday, July 30, 2009

What is the return value of system() in c++ on windows xp?

If I call a program with a system command, will the return value of system() be whatever the program returned?

What is the return value of system() in c++ on windows xp?
Assuming you mean Microsoft Visual C++, the Help system says this (among other things I'm not quoting here):





If command [the command string] is not NULL, system returns the value that is returned by the command interpreter. It returns the value 0 only if the command interpreter returns the value 0.
Reply:the return value of system(); is an integer that is platform dependant. Although it usually returns 0 for a successful execution of said system() command and some other value indicating an error.





Now really, do you not know how to use Google? This took me 10 seconds to find....


No comments:

Post a Comment