Returning a Value

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

Example:

String blah = system("some command");

Is this correct?

Answer:
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

Overview

Recent Articles: