I have a program like below
Code:
#define LEN 4048
FILE *ptr;
char line[LEN];
fp=popen(cmd,"r");
while(fgets(line,LEN,fp)!=NULL)
{
printf("%s",line);
strcat(dest,line);
}
printf("%s",dest);
i want to call a server program using the command line argument passed to this popen().
if i pass the cmd as -s(server), it fetches the server data and storing that in dest buffer.
i want to print the data received in "dest" outside the loop(while loop never exit for server)
Please help to print the data out of the while loop.