system() or _popen()?

Discussion in 'C++' started by Michael, Nov 11, 2004.

  1. Michael

    Michael Guest

    Hello,

    I am currently writing a C++ app to ftp new files.
    The C++ program will ftp to a server, get a list of files,
    compate that to a list of files already received and ftp
    the new files.

    Was using DOS script with various calls to small C++ programs
    but got very bulky and complex. Now, I am trying to write
    one C++ program to do all of the work.

    My question is can I use either system() or _popen to
    call "ftp" and capture the return code? Also, if someone
    has done something similar, it is easier to pipe the ftp
    output to a file and look at it, or could I just read through
    the buffer output?

    Thanks much!
     
    Michael, Nov 11, 2004
    #1
    1. Advertising

  2. Michael

    Default User Guest

    Michael wrote:

    > Hello,
    >
    > I am currently writing a C++ app to ftp new files.
    > The C++ program will ftp to a server, get a list of files,
    > compate that to a list of files already received and ftp
    > the new files.
    >
    > Was using DOS script with various calls to small C++ programs
    > but got very bulky and complex. Now, I am trying to write
    > one C++ program to do all of the work.
    >
    > My question is can I use either system() or _popen to
    > call "ftp" and capture the return code?


    If you want a portable C++ program, system() is the only thing
    available. Otherwise, you are in the wrong group.

    > Also, if someone
    > has done something similar, it is easier to pipe the ftp
    > output to a file and look at it, or could I just read through
    > the buffer output?


    How would you read through the output with system()?




    Brian
     
    Default User, Nov 11, 2004
    #2
    1. Advertising

  3. "Default User" <> wrote in message news:<>...

    > How would you read through the output with system()?


    Redirect the output of the controlled system, using the system's
    facilities for that (e.g. > on most ommand lines) then read back
    the created file, using ifstream.

    Regards,
    Michiel Salters
     
    Michiel Salters, Nov 12, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sfunds sfunds
    Replies:
    9
    Views:
    8,750
  2. Charles A. Lackman

    Streaming with System.IO and System.Net

    Charles A. Lackman, Dec 8, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    567
    Richard Grimes [MVP]
    Jan 15, 2005
  3. Michael
    Replies:
    1
    Views:
    1,792
    Ron Natalie
    Dec 1, 2004
  4. Replies:
    15
    Views:
    934
  5. Replies:
    2
    Views:
    112
Loading...

Share This Page