1753515 Members
5334 Online
108795 Solutions
New Discussion юеВ

access the ftp by ansi c

 
SOLVED
Go to solution
eran maor
Honored Contributor

access the ftp by ansi c

Hi to all !

i need a bit of assist with wroting an access to ftp in an ansi c program .

can some one help with examples
love computers
2 REPLIES 2
Carlos Ruiz
Occasional Contributor
Solution

Re: access the ftp by ansi c

A. Clay Stephenson
Acclaimed Contributor

Re: access the ftp by ansi c

Hi Eran:

It's really pretty simple

1) Build a temporary text file (e.g. /tmp/mycmds) that looks like this using fprintf's
open remote_hostname
user this_user this_user_password
ls (put get etc. go here)
quit
2) Create a temp output filename. e.g. my_out_fname
2) Then build a command string
e.g. sprintf(s_cmd,"ftp -n -i < %s > %s",my_tmp_cmd_fname,my_out_fname)
3) result = system(s_cmd)

OR
you could also use a popen to execute ftp.

Regards, Clay
If it ain't broke, I can fix that.