这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界» 论坛首页» 嵌入式开发» MCU» 关于ftpXfer 的使用

共2条 1/1 1 跳转至

关于ftpXfer 的使用

菜鸟
2005-04-06 18:09:07 打赏

对FTP的传输不明白,请大家先看一下help中的例程:

#include "vxWorks.h" #include "ftpLib.h" int ctrlSock; int dataSock; char buf [512]; int nBytes; STATUS status; if (ftpXfer ("server", "fred", "magic", "", "RETR %s", "/usr/fred", "myfile", &ctrlSock, &dataSock) == ERROR) return (ERROR); while ((nBytes = read (dataSock, buf, sizeof (buf))) > 0) { ... } close (dataSock); if (nBytes < 0) /* read error? */ status = ERROR; if (ftpReplyGet (ctrlSock, TRUE) != FTP_COMPLETE) status = ERROR; if (ftpCommand (ctrlSock, "QUIT", 0, 0, 0, 0, 0, 0) != FTP_COMPLETE) status = ERROR; close (ctrlSock);

以上是对目标机中单个文件的读取,我的问题是:

在使用ftpXfer 时,如果我有多个文件需要读

那么,对每一文件都要循环调用上述例程中的ftpXfer 、read、close (dataSock)、ftpReplyGet、ftpCommand、close (ctrlSock)么?

还是有别的什么简易的办法?

谢谢!




关键词: 关于 ftpXfer 使用

菜鸟
2005-04-07 23:52:00 打赏
2楼

再顶一下


共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册]