Just a basic PIPE:
Code:
int c1=0;
FILE *pi;
char temp[1000]={'\x00'};
char backupfilename[1000]={"backup.tar.gz"};
char c;
sprintf(temp, "gzip -vt %s", backupfilename);
pi=popen(temp, "r");
if(pi != NULL)
{
c=fgetc(pi);
while(c != '\xff')
{
temp[c1]=c;
c=fgetc(pi);
c1++;
}
temp[c1]='\x00';
pclose(pi);
}
The code then goes on the parse whats in the temp array, looking for the string "OK", so the program knows its ok. But of course the temp array is empty as the output from gzip isn't sent to STDOUT as you've said.
So how can I get the output from gzip into my temp array?
By the way many many thanks for your assistance, really is appreciated!!!