I want to save the output of a system command in a variable, to use it for a GTKLabel.
I know that I can use popen to record the output like this:
FILE *in;
extern FILE *popen();
char buff[512];
char test[512];
if(!(in = popen("adb devices", "r"))){
exit(1);
}
while(fgets(buff, sizeof(buff), in)!=NULL){
printf("%s", buff);
}
pclose(in);
So now, it does only print the Output, but I want to save it into a varible. How do i do that? Thanks in Advance community!