Witam pracuję w Dev-C++ i kompilator nie wykrywa żadnego błędu w moim programie. Plik zostaje wysłany za pomocą funkcji FtpPutFile ale nie zostaje odebrany funkcją FtpGetFile. Gdzie jest błąd? Czy mogę prosić o korektę?
#include <iostream>
#include <windows.h>
#include <wininet.h>
using namespace std;
void FileSubmit()
{
char user[32]="u797740858";
char pass[32]="P224ER";
char ftpserver[32]="hapsiu.pe.hu";
HINTERNET hInternet;
HINTERNET hFtpSession;
hInternet = InternetOpen(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);
hFtpSession = InternetConnect(hInternet,ftpserver , INTERNET_DEFAULT_FTP_PORT, user, pass, INTERNET_SERVICE_FTP, 0, 0);
if(FtpPutFile(hFtpSession, "test.txt", "onftp.txt", FTP_TRANSFER_TYPE_ASCII, INTERNET_FLAG_PASSIVE) == TRUE){
cout << "File Sent!" << endl;
InternetCloseHandle(hFtpSession);
InternetCloseHandle(hInternet);
}
else{
cout << "File not send!" << endl;
}
if(FtpGetFile(hFtpSession , "onftp.txt", "testrecived.txt", FALSE,INTERNET_FLAG_RELOAD,FTP_TRANSFER_TYPE_BINARY,0) == TRUE){
cout << "File recived!" << endl;
}else{
cout << "File not recived!" << endl;
}
}
int main(){
FileSubmit();
return 0;
}