system() or _popen()?

M

Michael

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!
 
D

Default User

Michael said:
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
 
M

Michiel Salters

Default User said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top