obiwankenobi6bone
asked on
ftp upload in vc++
hi experts,
i want to upload a file to ftp using following code:
m_intsession = new CInternetSession();
m_connection=m_intsession -> GetFtpConnection(FTPServer Val,FTPUse rVal,FTPPa ssVal);
CString str, source, target ;
CInternetFile *pfile ;
CFile fp ;
UINT count ;
source = "accessread.txt";
target = "accessread.txt";
fp.Open ( source, CFile::modeRead) ;
pfile = m_connection -> OpenFile ( target, GENERIC_WRITE, FTP_TRANSFER_TYPE_BINARY, 0 ) ;
pfile -> WriteString(ResultVar);
pfile -> Close( ) ;
fp.Close( ) ;
everything works fine... the file also gets uploaded (provided i press the ignore button in the following error message-box)...
the only problem is, i get the following error when "pfile -> WriteString(ResultVar);" is called:
Debug Assertion Failed
File: inet.cpp
Line: 1137
since i am a newbie in vc++ i dont know what to do...
please help me...
i want to upload a file to ftp using following code:
m_intsession = new CInternetSession();
m_connection=m_intsession -> GetFtpConnection(FTPServer
CString str, source, target ;
CInternetFile *pfile ;
CFile fp ;
UINT count ;
source = "accessread.txt";
target = "accessread.txt";
fp.Open ( source, CFile::modeRead) ;
pfile = m_connection -> OpenFile ( target, GENERIC_WRITE, FTP_TRANSFER_TYPE_BINARY, 0 ) ;
pfile -> WriteString(ResultVar);
pfile -> Close( ) ;
fp.Close( ) ;
everything works fine... the file also gets uploaded (provided i press the ignore button in the following error message-box)...
the only problem is, i get the following error when "pfile -> WriteString(ResultVar);" is called:
Debug Assertion Failed
File: inet.cpp
Line: 1137
since i am a newbie in vc++ i dont know what to do...
please help me...
just a thought, maybe you should check the return values of your called functions
pfile is set by m_connection
perhaps pfile is not set correctly hence the error
pfile is set by m_connection
perhaps pfile is not set correctly hence the error
always good practice to check return variables for failures
look in help for all the system calls you make for errors (been ages since I did C++)
look in help for all the system calls you make for errors (been ages since I did C++)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER