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 32 33 34 35 36 37 38 39 40 41
|
#include<iostream>
#include<windows.h>
#include<Wininet.h>
using namespace std;
int main()
{
HINTERNET hInternet;
HINTERNET hFtp;
hInternet=InternetOpen(0,INTERNET_OPEN_TYPE_DIRECT,0,0,0);
if(hInternet == NULL)
cout<<"\n1)Something goes wrong...\n";
else
cout<<"\n1)Everything is perfect...\n";
hFtp = InternetConnect(hInternet,"xxx.xxx.xxx",INTERNET_DEFAULT_FTP_PORT,"user","pass",INTERNET_SERVICE_FTP,0,0);
if(hFtp == NULL)
cout<<"\n2)Something goes wrong...\n";
else
cout<<"\n2)Everything is perfect...\n";
char szFile[] = "log";
strcat(szFile,".txt");
FtpPutFile(hFtp,szFile,"file.txt",INTERNET_FLAG_TRANSFER_BINARY,0);
InternetCloseHandle(hFtp);
InternetCloseHandle(hInternet);
return 0;
}
| |