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 <wininet.h>
#include <windows.h>
#include <iostream>
#include <string>
using namespace std;
int main()
{
//Declare
HINTERNET hInternet;
HINTERNET Folder;
HINTERNET Ftp;
//Connect
hInternet = InternetOpen(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);
Ftp = InternetConnect(hInternet,"ftp.drivehq.com",INTERNET_DEFAULT_FTP_PORT,"user","pass", INTERNET_SERVICE_FTP, 0,0 );
Folder = InternetConnect(hInternet,"ftp.drivehq.com",INTERNET_DEFAULT_FTP_PORT,"user","pass", INTERNET_SERVICE_FTP, 0,0 );
//Actions
FtpPutFile(Ftp,"Shutdown1.txt","Shutdown.txt",FTP_TRANSFER_TYPE_BINARY, 0);
FtpOpenFile(Folder,"Shutdown.txt",GENERIC_READ,INTERNET_FLAG_TRANSFER_BINARY,NULL);
if("Shutdown.txt" == "True")
{
cout << "Read successfully!";
}
//Close sessions
InternetCloseHandle(Ftp);
InternetCloseHandle(hInternet);
InternetCloseHandle(Folder);
}
|