I want to save the output from a bash script which is invoked from a C program to a variable declared in the C program. I searched and tried successfully calling a script using system
, and I tried this, but it didn't work:
char* a;
system("a=`ls`");
printf("%s",a);