005
18.08.2004, 19:16 Uhr
~mike
Gast
|
C++: |
CFtpConnection *pFtpConn = NULL; CInternetSession *pSession = NULL;
pSession = new CInternetSession(_T("FTP Upload"),1,PRE_CONFIG_INTERNET_ACCESS);
if(!pSession){ AfxMessageBox("Session konnte nicht gestartet werden!",MB_OK); return; }
if(pFtpConn != NULL) pFtpConn->Close();
delete pFtpConn; pFtpConn = NULL;
try { pFtpConn = pSession->GetFtpConnection("dev-geeks.org","XXX","XXX"); } catch(CInternetException *pEx) { TCHAR szErr[1024]; if(pEx->GetErrorMessage(szErr,1024)) AfxMessageBox(szErr,MB_OK); else AfxMessageBox("Allgemeiner Fehler",MB_OK);
pEx->Delete();
pFtpConn = NULL; return; }
bool load = pFtpConn->PutFile("C:\\test.dat","test.dat",FTP_TRANSFER_TYPE_BINARY,1); if(!load) AfxMessageBox("Upload Fehler");
pSession->Close(); pFtpConn->Close(); if(pFtpConn!=NULL) delete pFtpConn; if(pSession!=NULL) delete pSession;
|
mfg |