Capture output of spawned ftp program?
I need to launch ftp from a C program (freebsd) to send a short file and return. I would like to have the output of ftp redirected to my program to be able to verify successful completion. The return code from ftp doesn't necessarily indicate success/failure. I would like for my program to see "226 Transfer complete." from the normal ftp output for confirmation.
I can now use either 'execl' or 'system', redirect the output to a file, and then read from the file. Is there a better way to have the program (either child or parent) read the output of ftp directly via some type of redirection?
Thanks for any ideas!