win32 console application =>> FTP client

hi

how can i create program (ftp client) ?

tnx
Google up WinINET.
I would really NOT recommend wininet, for multiple reasons. Use libcurl instead, or, if you still have problems with some ftp servers (wininet have many problems) use sockets and implement the protocol directly (not very attractive solution).
winninet has alot of documentation, libcurl is a good option but it uses external libraries..
u can give me some example . how can i use that .
i have server ftp and i need download or upload some file . but my program before wright
this . (sry for en i'm noob)

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <tchar.h>
#include <urlmon.h>

#pragma comment(lib, "urlmon.lib")
using namespace std;


int WinMain(HINSTANCE hInstance, HINSTANCE hPreInstance, LPSTR CmdLine, int CmdShow)
{
	URLDownloadToFile ( NULL, _T("URL"),_T("C:\\test.jpg"), 0, NULL );
	return 0;
}

this code work but antivirus Detection my code :(
plz help :((
tnx

https://www.virustotal.com/file/244806c299167a662ee10a9b71ebf5e8ccff431e4a32d107f61f0264891c880c/analysis/1340396052/
here is code for ftp upload
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
27
28
29
30
31
int send(const char * ftp, const char * user, const char * pass, const char * pathondisk, char * nameonftp)
{
	
	HINTERNET hInternet;
	HINTERNET hFtpSession;
	hInternet = InternetOpen(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);
	if(hInternet==NULL)
	{
		return 1;
	}
	hFtpSession = InternetConnect(hInternet,(LPTSTR)ftp , INTERNET_DEFAULT_FTP_PORT, (LPTSTR)user, (LPTSTR)pass, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
	if(hFtpSession==NULL)
	{
		return 1;
	}
	char * buf=nameonftp;
	strcat(buf,".txt");
	int x = FtpPutFile(hFtpSession, (LPTSTR)pathondisk, (LPTSTR)buf, FTP_TRANSFER_TYPE_ASCII, 0);
	Sleep(1000);
	InternetCloseHandle(hFtpSession);
	InternetCloseHandle(hInternet);
	if(x==0)
	{
		return 1;
	}
	if(x==1)
	{
		return 0;
	}
	return 1;
}


you need to include
1
2
#include <wininet.h>
#pragma comment(lib, "wininet") 


don't just copy and paste, try to learn. and next time you ask question search on google and other fourms.
Regards
tnx

i find this .

http://msdn.microsoft.com/en-us/library/windows/desktop/aa384180%28v=vs.85%29.aspx

and i can understand your code and try to learn :D

but in code
hInternet = InternetOpen(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);

error me and get red line Under code
Regards
any Reply ?
Does the world really need another FTP client?

A reasonably friendly on is ncftp.
:|
any Reply ? :( plz
The need to find the RFC that describes the FTP protocol and implement that protocol.
Topic archived. No new replies allowed.