CInternetSession *cis;
CFtpConnection *ftp;
CInternetFile *IFile;
cis=new CInternetSession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);
try
{
ftp=cis->GetFtpConnection(ServerIP,UserName,Password,Port,true);
IFile=ftp->OpenFile("doc/python1.bmp");
CTest1Dlg::m_size=IFile->GetLength();
CTest1Dlg::m_tag="1";
UpdateData(FALSE);
}
catch(CInternetException *pEx)
{
CTest1Dlg::m_tag="0";
UpdateData(FALSE);
pEx->Delete();
}
但是不管什么文件都是4320
CFtpConnection *ftp;
CInternetFile *IFile;
cis=new CInternetSession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);
try
{
ftp=cis->GetFtpConnection(ServerIP,UserName,Password,Port,true);
IFile=ftp->OpenFile("doc/python1.bmp");
CTest1Dlg::m_size=IFile->GetLength();
CTest1Dlg::m_tag="1";
UpdateData(FALSE);
}
catch(CInternetException *pEx)
{
CTest1Dlg::m_tag="0";
UpdateData(FALSE);
pEx->Delete();
}
但是不管什么文件都是4320
解决方案 »
- delete 报错
- 高分!关于VC++,TAB控件
- 请各位大大推荐本书--关于图像编程的书籍
- 实现MD5算法调用advapi32.dll中相关api 在有的XP上成功,有的却失败了
- Opengl绘图区的长度距离单位和父窗口中的一样吗?
- 一个ATL工程怎么实现属性页?
- 有没有人有学习编写游戏代码的好资料啊?最好是能有游戏学校上课的视频,或者是其它的视频教程,谢谢
- 执行ExecuteSQL出现语法错误,为什么?
- CArray<CPoint,CPoint> m_ptArray; 语句前面应当加什么头文件
- 关于远程控制...
- GetNextView 问题
- 请问,在win98下,怎样让运行的win32 console application 程序不出现在任务栏中?多谢!
可是,几十K以上的,就不行了,有人告诉我一下吗
CTest1Dlg::m_size我这个是long类型的
HINSTANCE hInst = LoadLibrary("wininet.dll");
if(hInst == NULL)
{
...
}FtpGetFileSize_Proc pfnFtpGetFileSize = (FtpGetFileSize_Proc)GetProcAddress(hInst, "FtpGetFileSize");HINTERNET hFile = FtpOpenFile(....);
if (hFile == NULL)
{
...
}file_len = pfnFtpGetFileSize(hFile, NULL);
FreeLibrary(hInst );
if(file)
{
char mydata[256] = {0};
DWORD dwBytesReaded = 0;
while (TRUE)
{
int nowbytes = 0;
nowbytes = file->Read(mydata, 256);
if ( nowbytes == 0) break;
dwBytesReaded += nowbytes;
}
cb = dwBytesReaded;
}cb是文件长度
CString Temp;
Temp="SIZE //test.jpg\r\n";
testSocket.Send(Temp,Temp.GetLength(),0);
int n1;
CString sResp;
char sRecv[255] = {0};
n1=testSocket.Receive(sRecv,255);
sResp=sRecv;
sResp=sResp.Right(sResp.GetLength()-4);
FileSize=atof(sResp);