for now this is my code. This command will execute a script and supposed to return Safari browser version on Mac if its run in the Terminal.
int versionResult = system("osascript /Library/Application\\ Support/Version.scpt");
In C++, this wil return 1 or 0.
How can I make it return the result of the command in C++?
You can’t do it with
system; there’s no platform-independent way to do it without using a cross-platform framework likeQt. That looks like a Mac command; to do this on the Mac, which is Unix-like, you could usepopen(), something likebuffergets the output of the command as a character string.