FTP Client

Hello,

Attempting to code a function to download a file from a website, does anyone have experience with this? Need some guidance.

Thanks
I have FTP access to the website
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

#include <wininet.h>

#include <windows.h>

int main()
{
	HINTERNET hInternet = InternetOpen(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0); // Initialization for WinInet Functions
   if(!hInternet) { return 1; }

   // Starts a session in this case an FTP session
   HINTERNET hFtpSession = InternetConnect(hInternet,"SERVER",INTERNET_DEFAULT_FTP_PORT,"USERNAME","PASSWORD", INTERNET_SERVICE_FTP,INTERNET_FLAG_PASSIVE,0);
	if(!hFtpSession) {
	  InternetCloseHandle(hInternet);
	  return 1;
	}

   FtpPutFile(hFtpSession, "C:\\Test.txt","Test.txt", FTP_TRANSFER_TYPE_BINARY, 0);
   // Uploads the file C:\\Test.txt onto the FTP server as Test.txt

   InternetCloseHandle(hFtpSession); // Close hFtpSession
   InternetCloseHandle(hInternet); // Close hInternet
	return 0;
}



C:\Users\G\Desktop\FTP.o:FTP.cpp:(.text+0x52): undefined reference to `_InternetOpenA@20'
C:\Users\G\Desktop\FTP.o:FTP.cpp:(.text+0xad): undefined reference to `_InternetConnectA@32'
C:\Users\G\Desktop\FTP.o:FTP.cpp:(.text+0xc4): undefined reference to `_InternetCloseHandle@4'
C:\Users\G\Desktop\FTP.o:FTP.cpp:(.text+0xfb): undefined reference to `_FtpPutFileA@20'
C:\Users\G\Desktop\FTP.o:FTP.cpp:(.text+0x109): undefined reference to `_InternetCloseHandle@4'
C:\Users\G\Desktop\FTP.o:FTP.cpp:(.text+0x117): undefined reference to `_InternetCloseHandle@4'



Topic archived. No new replies allowed.