Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ftp using c 1

Status
Not open for further replies.

sramki

Programmer
May 8, 2001
27
0
0
IN
hey all

i would like to ftp a file to a web server .
i will get the web server name from the GUI screen i have and store it in a database .
From the database i shd fetch the path of the server and send a corresponding file to that server .

i need to just know abt the FTP part .how can i do it using C .
how do i initiate the ftp process and transfer the file using a c program .
iam using linux and c .
pl. help very urgent .
keep mailing
regards
ramki





 
Well, a few different possibilities:

1.
You could pick up a book on sockets (UNIX Network Programming Volume 1 - W. Richard Stevens is good) and write your own FTP client. This isn't something you'll be able to put together quickly unless you're already comfortable with sockets programming on UNIXes.

2.
Do a web search for an FTP client example in C. There are a few of these floating around and try to incorporate it into your program.

3.
Download an open source package that implements an FTP client. The bare bones FTP client that comes with most (all?) Linux distributions is a good start. You should be able to get the source off a CD in your distribution. If not, it can be easily gotten off the web.

Then, hack apart the source, setting up entry points for your program into the functionality you want. Compile and link.

4. (easiest and quickest)
Call system() or popen() to execute the FTP program on your system, passing it the arguments (user name, password, file name etc.) it needs to connect to the FTP server and upload the file. Take a look at man ftp to find out how to invoke the program to do what you want it to do.
Russ
bobbitts@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top