본문 바로가기

IT

popen example

#include <stdio.h>

#include <stdlib.h>


int main()

{

FILE *fp;

char buf[100];

int i = 0;


fp = popen("who|sort","r");

while(fgets(buf,100,fp)!=NULL)

printf("%3d %s", i++, buf);

pclose(fp);

return 0;

}



'IT' 카테고리의 다른 글

timeclnt.c  (0) 2014.11.20
timeserv.c  (0) 2014.11.19
tiny bc  (0) 2014.11.19
theFinale.c  (0) 2014.11.12
redirect1.c  (0) 2014.11.12