Make FTP Send function build 600 compatible

 

Hello,

i have a older FTP send function which is build with wininet.dll functions import and this builded FTP function have also a problem with the new MT4 build 600, can somebody take a look please and tell me how to modfy my current FTP function function to make it MT4 build 600 compatible?

bool SendWithFTP(string str)
{
//----
   int hIntObj, hIntObjConn;
   string Password, ServerName, UserName, LocalFile, HostFile;
   bool Success;

   //Uploading the file
   hIntObj=InternetOpenA("MyInternetObjectName",1,NULL,NULL,NULL);//We create an object of type "Internet"
   if (hIntObj>0)
      {
         ServerName=FTPServer;//Your ftp server
         UserName=FTPUsername;//Your username you use when manually establish a ftp session
         Password=FTPPassword;//Your password you use when manually establish a ftp session
         hIntObjConn=InternetConnectA(hIntObj, ServerName, 0, UserName, Password, INTERNET_SERVICE_FTP, NULL, NULL);//We hang a FTP session on our internet object created. The session could have been a HTTP session or even a HTTPS session. See http://msdn.microsoft.com/en-us/library/aa385473(VS.85).aspx
         if (hIntObjConn>0)
            {
               string path=TerminalPath()+"\experts\files\\"+str;
               LocalFile=path;//The physical address in your local machine where the file to be uploaded is.
               path=str;
               HostFile=path;//The name of the remote file uploaded
               Success=FtpPutFileA(hIntObjConn, LocalFile, HostFile, FTP_TRANSFER_TYPE_BINARY, NULL);               
               if(Success)Print("SendFTP  "+str+" Update: ",TimeToStr(TimeCurrent(),TIME_DATE|TIME_MINUTES|TIME_SECONDS));
               if(Success==false)Print("SendFTP  error "+str+" at: ",TimeToStr(TimeCurrent(),TIME_DATE|TIME_MINUTES|TIME_SECONDS));
            }
      }
   InternetCloseHandle(hIntObj);
return(Success);
//----
}
 

since B600 > all string are UNICODE you have to adapt your code for instance InternetOpenW instead of InternetOpenA

and maybe some conversions such as CharArrayToString or ShortArrayToString Etc.

SendFTP doesn't work ?


 
qjol:

since B600 > all string are UNICODE you have to adapt your code for instance InternetOpenW instead of InternetOpenA

and maybe some conversions such as CharArrayToString or ShortArrayToString Etc.

SendFTP doesn't work ?



With the MT4 SendFTP i had get often problems, this one is normaly working better, but i must make it now work on the new MT4 build
 
PlanandTrade:

but i must make it now work on the new MT4 build
then start working https://www.mql5.com/en/forum/150989