I have code that looks like this:
char* buff = malloc(strlen(argv[1])+200);
if (!buff)
{
printf("%s\n", "Error allocating memory!");
return -1;
}
sprintf(buff, "%s%s%s%s", "gcc ", argv[1], " -o ", findChars(argv[1], '.'));
FILE* command = popen(buff, "r");
// NEED TO RETRIEVE OUTPUT OF POPEN
pclose(command);
And this works, but I need to save the output of the POPEN to a char* so I can read it. (This is in C)