Link to home
Start Free TrialLog in
Avatar of obiwankenobi6bone
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(FTPServerVal,FTPUserVal,FTPPassVal);
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...
Avatar of obiwankenobi6bone
obiwankenobi6bone

ASKER

ahhh... forgot to say that the variable ResultVar is a CString...
Avatar of rockiroads
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
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++)
ASKER CERTIFIED SOLUTION
Avatar of hal3000
hal3000

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial