I'm using the execl function to run a Linux process from C.  When I do, for example:
int cmd_quem() { 
  int result; 
  result = fork();
  if(result < 0) {
    exit(-1);
  }
  if (result == 0) {
    execl("/usr/bin/who", "who", NULL);
    sleep(4); //checking if father is being polite 
    exit(1); 
  } 
  else { 
    // father's time
    wait();
  }
  return 0;
}
I get on the console the result of doing "who" on the terminal. What I'd like to know is if there is any function to "catch" the output result from a command. What I mean is, if there is anyway to catch this:
feuplive tty5         2009-11-21 18:20
Which is one of the lines resulting from the who command.