首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

怎么在linux下用c语言实现ftp编程

2012-02-16 
如何在linux下用c语言实现ftp编程我想在一个ftp服务器上实现上传下载文件功能,请问c语言的如何实现?我的系

如何在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

热点排行