1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
int send(const char * ftp, const char * user, const char * pass, const char * pathondisk, char * nameonftp)
{
HINTERNET hInternet;
HINTERNET hFtpSession;
hInternet = InternetOpen(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);
if(hInternet==NULL)
{
return 1;
}
hFtpSession = InternetConnect(hInternet,(LPTSTR)ftp , INTERNET_DEFAULT_FTP_PORT, (LPTSTR)user, (LPTSTR)pass, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
if(hFtpSession==NULL)
{
return 1;
}
char * buf=nameonftp;
strcat(buf,".txt");
int x = FtpPutFile(hFtpSession, (LPTSTR)pathondisk, (LPTSTR)buf, FTP_TRANSFER_TYPE_ASCII, 0);
Sleep(1000);
InternetCloseHandle(hFtpSession);
InternetCloseHandle(hInternet);
if(x==0)
{
return 1;
}
if(x==1)
{
return 0;
}
return 1;
}
|