473,395 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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!
Jul 22 '05 #1
2 2036
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

Jul 22 '05 #2
"Default User" <fi********@boeing.com.invalid> wrote in message news:<I7********@news.boeing.com>...
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
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Terrence | last post by:
I am doing some of the C# walkthroughs to transition from VB to C#. When I try to execute static void Main() { Aplication.Run(new Form1()) } I raise a 'System.NullReferenceException" in...
3
by: Arvin Portlock | last post by:
I've written a perl cgi script but it's too slow so I need to rewrite it in C++. The perl script passes parameters to a search engine on our local filesystem and processes the results (number of...
1
by: Michael | last post by:
Hello, Not sure if this is the right message board but I have an interesting problem. Using Visual Studio .NET, C++, I want to write an all-encompassing C++ program to download new files from...
5
by: laks | last post by:
Hi I have the following xsl stmt. <xsl:for-each select="JOB_POSTINGS/JOB_POSTING \"> <xsl:sort select="JOB_TITLE" order="ascending"/> This works fine when I use it. But when using multiple...
0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
21
by: Neel | last post by:
I am trying to "ping" a remote host in my C++/Redhat Linux code to check whether that host is connected or not. if (0 == system("ping -w 2 192.168.0.2)) But, in both cases...
3
by: Frank Liebelt | last post by:
Hi I am a beginner in c++. In my little program i would unpack a tar file with a system call. system("tar -xfv unpack.tar"); Is it possible to check that the tar command was successfull or...
6
by: JohnF | last post by:
I'd like to capture the stdout output from system("command") in a buffer. Although system("command >tmpnam") and then open,read,remove tmpnam works, it's a bit more messy than I'd like. Is there...
13
by: thomas.mertes | last post by:
Hello Recently I discovered some problem. I have some C code which determines how many bytes are available in a file. Later I use this information to malloc a buffer of the correct size before...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.