system() or _popen()?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael

    system() or _popen()?

    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!
  • Default User

    #2
    Re: system() or _popen()?

    Michael wrote:
    [color=blue]
    > 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?[/color]

    If you want a portable C++ program, system() is the only thing
    available. Otherwise, you are in the wrong group.
    [color=blue]
    > 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?[/color]

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




    Brian

    Comment

    • Michiel Salters

      #3
      Re: system() or _popen()?

      "Default User" <first.last@boe ing.com.invalid > wrote in message news:<I71BoI.DH F@news.boeing.c om>...
      [color=blue]
      > How would you read through the output with system()?[/color]

      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

      Comment

      Working...