Oct 6, 2014 at 2:07pm UTC
Hello
I'm writing a very simple FTP manager,when I send a message to RETRIEVE the file from server my Application falls into a Run-time Error and I Don't Know Why.
this function been used in FtpCommand -as an Internet Handle for Connection- and it works properly:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
HINTERNET ftpConnection(const char * szHost,const char * szusrName,const char * szPass)
{
HINTERNET hOpnFuncFtp=InternetOpen("FTP-Agents" ,NULL,NULL,NULL,NULL);
HINTERNET hConFuncFtp=InternetConnect(hOpnFuncFtp,szHost,INTERNET_DEFAULT_FTP_PORT,
szusrName,szPass,INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE ,NULL);
if (!hConFuncFtp)
{
SetLastError(6);
return (HINTERNET)0xffffffff;
}
return hConFuncFtp;
}
the problem comes up when I'm trying to send a RETR command to the server:
1 2
FtpCommand(Connection2FTP,TRUE,INTERNET_FLAG_TRANSFER_BINARY,
"RETR /OMG/HELLO1\r\n" ,NULL,&respondFtp);
at this line my application goes to a Run-Time Error!
as shown in top i'm trying to retrieve HELLO1 file in /OMG/ path from server
I guess it's a problem with syntax of FTP Command and perhaps /OMG/HELLO1 shouldn't be there or ...
whatever i saw
https://www.ietf.org/rfc/rfc959.txt
so don't push me there please ;)
the Run-Time Error Message:
1 2
Unhandled exception at 0x7780D193 (msvcrt.dll) in FTPTrans.exe:
0xC0000005:Access violation reading location 0x00000001.
Best,
John Smith.
Last edited on Oct 6, 2014 at 2:09pm UTC