LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-02-2012, 01:55 PM   #1
dromey
LQ Newbie
 
Registered: Aug 2012
Posts: 1

Rep: Reputation: Disabled
Question automatic connection to the FTP


I need to logon to an ftp using a user-name and password, send a file, get a file and then logoff.

for example:

ftp 1.2.3.3
Connected to 1.2.3.4.
Name (1.2.3.4:user): user-name
Password required for user-name.
Password: password
User user-name logged in.
ftp>

and then send a file and then receive a file.

Two questions:

1) How to send and recevie files with ftp?
2) how to automate this from a c++ program. I have tried system() for each line above but it does nothing.

I am working on an embedded platfrom and have few programs current available so would prefer to use ftp rather than kermi or lftp.

Any ideas?
 
Old 08-02-2012, 04:54 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by dromey View Post
I need to logon to an ftp using a user-name and password, send a file, get a file and then logoff.

for example:

ftp 1.2.3.3
Connected to 1.2.3.4.
Name (1.2.3.4:user): user-name
Password required for user-name.
Password: password
User user-name logged in.
ftp>

and then send a file and then receive a file.

Two questions:

1) How to send and recevie files with ftp?
2) how to automate this from a c++ program. I have tried system() for each line above but it does nothing.

I am working on an embedded platfrom and have few programs current available so would prefer to use ftp rather than kermi or lftp.

Any ideas?
There is web search, you know ? E.g. https://duckduckgo.com/?q=free+C%2B%2B+FTP+library . An in my case second match yields http://stackoverflow.com/questions/1.../c-ftp-library and there one comes across libCurl.

Which, of course, can be found at http://curl.haxx.se/ .
 
Old 08-02-2012, 06:45 PM   #3
riovine
LQ Newbie
 
Registered: Aug 2012
Posts: 1

Rep: Reputation: Disabled
The best way to do that is via an 'expect' script. Just google something like 'expect ftp script", there should be a lot of examples.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic download from FTP KrzysieQ Linux - Networking 2 10-05-2008 08:42 AM
automatic sending of files thru ftp. visitnag Linux - Newbie 8 09-09-2008 08:06 AM
Automatic FTP Backup aquaboot Linux - Software 5 06-03-2006 06:34 PM
Automatic FTP greatmenon Linux - Software 1 01-20-2006 10:09 PM
FTP - remote login (automatic?) claudiascotti Linux - Networking 4 05-23-2005 03:14 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration