Hello,
What is a good way to call 'uname -a' from a C++ program and send the results to a stream?
I looked at system() and exec(), but they do not seem to give access to the stdout of the call.
Thanks.
-William
Hello,
What is a good way to call 'uname -a' from a C++ program and send the results to a stream?
I looked at system() and exec(), but they do not seem to give access to the stdout of the call.
Thanks.
-William
See here http://stackoverflow.com/questions/300669/launch-app-capture-stdout-and-stderr-in-c for a possible way.
Why not just retrieve the strings directly from the struct utsname returned from the uname(2) system call found on most Unix/Unix-like platforms?
No need to fork a "uname -a" process.