Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > system() or _popen()?

Reply
Thread Tools

system() or _popen()?

 
 
Michael
Guest
Posts: n/a
 
      11-11-2004
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!
 
Reply With Quote
 
 
 
 
Default User
Guest
Posts: n/a
 
      11-11-2004
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

 
Reply With Quote
 
 
 
 
Michiel Salters
Guest
Posts: n/a
 
      11-12-2004
"Default User" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...

> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments