I am using int res = system("uname -p"); in my c++ code.
It will give the the result in standard output by using
fprintf(stdout,"execution returned %d.\n",res);
I want to store this result string in a variable, I am unable to store it.
I google it but unable to find proper solution, Can any one tell me the correct way.
uname -pin a string variable.uname -pin a terminal on my computer, and it outputsi386. You want to end up with a string variable that containsi386, right? If so, you'll needpopen()and read from the stream it returns.