cURL creating directory

I am trying to create directory, using cURL library, but I can't get it working.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sprintf_s	( info, sizeof info, "mkdir %s", dir );

	curl_slist	* slist	= NULL;
	slist	= curl_slist_append	( slist, info );

	if	( curl_easy_setopt	( Handle, CURLOPT_QUOTE, slist ) )
		return 0;
	
	res	= curl_easy_perform	( Handle );
	
	curl_easy_cleanup		( Handle );

	if	( res )
	{
		logprintf	( "%d", res );
		return 0;
	}


I am getting error '21', and ftp server says: '500 Syntax error, command unrecognized.'. What I am missing?
closed account (DSLq5Di1)
http://stackoverflow.com/questions/1985591/libcurl-and-mkdir
thanks
Now another problem. Code:
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
int	CFTP::TryLogin	( )
{
	if	( ServerName == NULL || UserName == NULL || Password == NULL )
		return 0;

	Handle	= curl_easy_init	( );
		
	if	( Handle == NULL )
		return 0;

	char
		info [ 150 ];

	sprintf_s	( info, sizeof info, "ftp://%s/", ServerName );

	if	( curl_easy_setopt	( Handle, CURLOPT_URL, info ) )
	{
		curl_easy_cleanup	( Handle );
		return 0;
	}

	sprintf_s	( info, sizeof info, "%s:%s", UserName, Password );
	if	( curl_easy_setopt	( Handle, CURLOPT_USERPWD, info ) )
	{
		curl_easy_cleanup	( Handle );
		return 0;
	}

	return 1;
}

int	CFTP::CreateDir	( const char * dir )
{
	if	( !CFTP::TryLogin ( ) )
	{
		curl_easy_cleanup	( Handle );
		return 0;
	}

	char
		info	[ MAX_PATH + 5 ];

	sprintf_s	( info, sizeof info, "MKD %s", dir );

	curl_slist	* slist	= NULL;
	slist	= curl_slist_append	( slist, info );

	if	( curl_easy_setopt	( Handle, CURLOPT_QUOTE, slist ) )
	{
		curl_easy_cleanup	( Handle );
		return 0;
	}

	curl_slist_free_all		( slist );
	res	= curl_easy_perform	( Handle );
	curl_easy_cleanup		( Handle );
	
	if	( res )
		return 0;

	return 1;
}


cURL sends command, but in FTP server types:
1
2
3
4
5
6
> P	WWP
W
WPWWŠ	Wżżżżź
<
c

Instead of:
 
MDR directory

What's wrong?
closed account (DSLq5Di1)
I have zero experience with cURL.. but from looking at that code, shouldn't you free slist after your call to curl_easy_perform?
Yea, I'd figured that out, but still thanks.
Topic archived. No new replies allowed.