Download MetaTrader 5
To add comments, please log in or register
Download MQL5 library codes via MetaTrader. It is convenient!
Tradeing Trader
556
Tradeing Trader 2014.04.09 08:46 

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);
//----
}
qjol
3243
qjol 2014.04.09 09:27  

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 ?


Tradeing Trader
556
Tradeing Trader 2014.04.09 19:58  
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
qjol
3243
qjol 2014.04.09 20:25  
PlanandTrade:

but i must make it now work on the new MT4 build
then start working https://www.mql5.com/en/forum/150989
/
To add comments, please log in or register