Thread: Capture output of spawned ftp program?

  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    2

    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!

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    man popen


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    2

    Smile Thank you!

    Perfect answer. It works!

    ...chuck

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. c program that accepts and executes commands?
    By Cimposter in forum C Programming
    Replies: 3
    Last Post: 09-30-2009, 02:58 PM
  2. Basic C input output program help
    By trevordunstan in forum C Programming
    Replies: 2
    Last Post: 01-27-2008, 06:41 PM
  3. GPL license: how does it cover the output of a program?
    By psychopath in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 05-25-2006, 01:37 AM
  4. Can we use select() to capture output from execl()?
    By Nessarose in forum Networking/Device Communication
    Replies: 5
    Last Post: 07-05-2005, 12:53 AM
  5. program output is empty!!!
    By ayesha in forum C++ Programming
    Replies: 4
    Last Post: 10-15-2001, 10:42 PM