you can also use a popen with sendmail
this works just like working with files on the harddrive
Code:
FILE *command;
command = popen ( "ps -A"."r");
this code would put the output of ps -A into the stream command that you could parse with sscanf or some other function to get the data or work with it.