#include <stdio.h>
#include <stdlib.h>
int main(int argc,char **argv)
{
char *cmd = "whoami";
char buf[BUFSIZ];
FILE *ptr;
if ((ptr = popen(cmd, "r")) != NULL)
while (fgets(buf, BUFSIZ, ptr) != NULL)
(void) printf("%s", buf);
(void) pclose(ptr);
return 0;
}
#include <stdlib.h>
int main(int argc,char **argv)
{
system("whoami");
return 0;
}