日期:2014-05-16  浏览次数:20709 次

如何在linux下用c语言实现ftp编程
我想在一个ftp服务器上实现上传下载文件功能,请问c语言的如何实现?我的系统是suse   linux。如果有源码请发到邮箱:wuweiww525@163.com,万分感谢。


------解决方案--------------------
去查linux的ftpd源码好了

自己写的话参考RFC
------解决方案--------------------
shell就可以了
------解决方案--------------------
用c system shell就可以了..自己去实现太麻烦.
------解决方案--------------------
curl
------解决方案--------------------
Is that you just want write a ftp client application? If so, I will provide support.
------解决方案--------------------
用ftplib庫,內有完整範例.
curl也不錯.
------解决方案--------------------
下載ftplib,
實現在ftplib.c中
http://nbpfaus.net/~pfau/ftplib/


89 int ftpput_test()
90 {
91 static netbuf *conn = NULL;
92 char *host= "ftpserver " ;
93 char *user= "uesr ";
94 char *pass= "pass " ;
95
96
97 int i ;
98 FtpInit();
99
100 if (!FtpConnect(host,&conn))
101 {
102 fprintf(stderr, "Unable to connect to node %s\n%s ",host,ftplib_lastresp);
103 return (EX_CONNECT);
104 }
105
106 if (!FtpLogin(user,pass,conn))
107 {
108 fprintf(stderr, "Login failure\n%s ",FtpLastResponse(conn));
109 return EX_LOGIN;
110 }
111
112 i = FtpPut( "test.h ", "test.h ", FTPLIB_IMAGE ,conn);
113
114
115
116 if (conn)
117 FtpClose(conn);
118
119 return 0 ;
120 }
121