关于VC中FTP上传! 用VC做了一个程序,当中带着一些FTP的,做好以后发现FTP到对方三个子目录内都可以,如果超过三个就失败了。搞得很郁闷。不知道哪位知道在VC中代码如何写才能保证FTP进入多少个子目录都可以? 谢了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 进入当前目录,下载,再进入下一目录下载。ftp协议里,进入另一目录是有命令的.static int FtpXfer(const char *localfile, const char *path, netbuf *nControl, int typ, int mode){ int l,c; char *dbuf; FILE *local = NULL; netbuf *nData; int rv=1; if (localfile != NULL) { char ac[4] = "w"; if (typ == FTPLIB_FILE_WRITE) ac[0] = 'r'; if (mode == FTPLIB_IMAGE) ac[1] = 'b'; local = fopen(localfile, ac); if (local == NULL) { strncpy(nControl->response, strerror(errno), sizeof(nControl->response)); return 0; } } if (local == NULL) local = (typ == FTPLIB_FILE_WRITE) ? stdin : stdout; if (!FtpAccess(path, typ, mode, nControl, &nData)) return 0; dbuf = malloc(FTPLIB_BUFSIZ); if (typ == FTPLIB_FILE_WRITE) { while ((l = fread(dbuf, 1, FTPLIB_BUFSIZ, local)) > 0) if ((c = FtpWrite(dbuf, l, nData)) < l) { printf("short write: passed %d, wrote %d\n", l, c); rv = 0; break; } } else { while ((l = FtpRead(dbuf, FTPLIB_BUFSIZ, nData)) > 0) if (fwrite(dbuf, 1, l, local) <= 0) { perror("localfile write"); rv = 0; break; } } free(dbuf); fflush(local); if (localfile != NULL) fclose(local); FtpClose(nData); return rv;} www.wantsoft.com 隐形者源码交流 新手求助!!急! 在vs2008的vc对话框设计器中,如何运行程序就能看设计效果? 请问ATL如何响应插拔U盘的事件? 关于对话框之间的简单调用问题~!◎?? 编译出错,大虾看过来 各位仁兄给些建议 ,我该怎样读VC++6 的MFC创建的程序! 求矩阵(大量)的特征值的的C++源程序或VC CEDIT的CTRL+TAB问题 很简单的问题,关于LPCWSTR的问题 有那位大侠知道QQ数据包的解密算法? 新手请教VC++基于对话框编程 按钮问题 CTreeListCTRL的InsertColumn不能显示插入的文字。高手快来啊。在线等。
ftp协议里,进入另一目录是有命令的.static int FtpXfer(const char *localfile, const char *path,
netbuf *nControl, int typ, int mode)
{
int l,c;
char *dbuf;
FILE *local = NULL;
netbuf *nData;
int rv=1; if (localfile != NULL)
{
char ac[4] = "w";
if (typ == FTPLIB_FILE_WRITE)
ac[0] = 'r';
if (mode == FTPLIB_IMAGE)
ac[1] = 'b';
local = fopen(localfile, ac);
if (local == NULL)
{
strncpy(nControl->response, strerror(errno), sizeof(nControl->response));
return 0;
}
}
if (local == NULL)
local = (typ == FTPLIB_FILE_WRITE) ? stdin : stdout;
if (!FtpAccess(path, typ, mode, nControl, &nData))
return 0;
dbuf = malloc(FTPLIB_BUFSIZ);
if (typ == FTPLIB_FILE_WRITE)
{
while ((l = fread(dbuf, 1, FTPLIB_BUFSIZ, local)) > 0)
if ((c = FtpWrite(dbuf, l, nData)) < l)
{
printf("short write: passed %d, wrote %d\n", l, c);
rv = 0;
break;
}
}
else
{
while ((l = FtpRead(dbuf, FTPLIB_BUFSIZ, nData)) > 0)
if (fwrite(dbuf, 1, l, local) <= 0)
{
perror("localfile write");
rv = 0;
break;
}
}
free(dbuf);
fflush(local);
if (localfile != NULL)
fclose(local);
FtpClose(nData);
return rv;
}
www.wantsoft.com 隐形者源码交流