Code:
FILE *fp;
char pid[MAX]="ps -eo pid,pcpu,pmem";
fp=popen(pid,"r");
while (fgets(pid, MAX, fp)!=NULL)
printf("%s",pid);
pclose(fp);
if i give input as pid of a process, how can i get the %cpu and mem of that process only?
can someone gimme the code to it?
thanks in advance

