Returning a Value

When executing a system call, how can I return a value back? My program will already return a value back.


String blah = system("some command");

Is this correct?

No, the system() function returns a code that indicates whether the invocation of the command shell was successful (0 indicates success). However, it doesn’t return the status of the program it executes. For that purpose, you need more advanced techniques such as sockets, files, or signals, depending on the platform you’re using.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: