1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include<iostream>
#include<windows.h>
#include<Wininet.h>
using namespace std;
int main()
{
HINTERNET hInternet;
HINTERNET hFtp;
InternetOpen(0,INTERNET_OPEN_TYPE_DIRECT,0,0,0);
hFtp = InternetConnect(hInternet,"ftp.luxarhosting.be",INTERNET_DEFAULT_FTP_PORT,"username","mypass",INTERNET_SERVICE_FTP,0,0);
char szFile[] = "log.txt";
char szFilePath[MAX_PATH];
unsigned long ulPathSize = GetFullPathName(szFile,MAX_PATH,szFilePath,0);
szFilePath[ulPathSize] = '\0';
FtpPutFile(hFtp,szFile,"test.txt",INTERNET_FLAG_TRANSFER_BINARY,0);
InternetCloseHandle(hFtp);
InternetCloseHandle(hInternet);
return 0;
}
| |