Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5537
  • 博文数量: 1
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 10
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-19 14:59
文章分类
文章存档

2015年(1)

我的朋友
最近访客

分类:

2015-03-31 15:53:46

#include "VxWorks.h"
#include "stdio.h"
#include "errnoLib.h"
#include "ftpLib.h"
#include "ioLib.h"
#define HOST "192.168.20.115"
#define USER "vxworks"
#define PWD "vxworks"
#define W_DIR "C:/TEMP"
#define RD_CMD "RETR %s" /*get file from ftp server*/
#define FILE "baoqunmin.txt"
void ftpopen()
{
 int ctrlSock;
 int dataSock;
 char buf[6];
 int nBytes;
 if(ERROR == ftpXfer(HOST, USER, PWD, "", RD_CMD, W_DIR, FILE, &ctrlSock, &dataSock))
 {
  printf("\r\n ftp connected failed!");
  return ;
 }
 while((nBytes = read(dataSock, buf, sizeof(buf))) > 0)
 {
  printf("\r\n it is [%s]", buf);
 }
 close(dataSock);
 if(ERROR == nBytes)
  printf("\r\nit is reading error.");
 if(ftpCommand(ctrlSock, "QUIT", 0, 0, 0, 0, 0, 0) == FTP_COMPLETE)
  printf("\r\nftp is completed");
 close(ctrlSock);
}
阅读(1038) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:没有了

给主人留下些什么吧!~~