I am facing the problem while developing the following functionalities,

  1. Establishing the FTP connection by opening the Internet session with the help of server name, username, password, FTP Port number.
  2. If there is a problem with the connection then it will log a message.

Please suggest me how to implement the above scenarion in C++ in QNX.


Maybe look at libcurl. It builds from pkgsrc
or the source from the networking project
on the foundry.



Thanks for your quick reply.
Please tell from where I can download or get the libcurl.


Please see my previous post:

“It builds from pkgsrc or the source from the
networking project on the foundry.”

Or you can wait for 6.5 which will ship with libcurl.


I have downloaded the LibCurl from curl.haxx.se/download.html for QNX.
In this Library, I have refered the Man page curl.haxx.se/docs/manpage.html. Its giving all the commands not API.
So, I am still searching for the specific API for establishing the FTP connection using server name, username, password, FTP Port number.

Please suggest me how to do the same

I am able to establish the FTP connection and able to transfer the file using Lib Curl file.
Now, I am facing the problems which are as follows,

  1. Single Command used to establish the FTP connection using Username and Password is “ftp ftp://amol:amol@171.224.559.216:21
    But I am unable to establish the connection.
  2. I want to search/find the specific file (*.txt) in the given directory using Curl library.

Please help me to solve the issue.

Now I am able to establish the FTP connection using single command i.e. ftp “ftp://amol:amol@171.224.559.216:21” .
But still I need to search/find the specific file (*.txt) in the given directory using API of Curl Library.

Any help in finding a solution would be greatly appreciated.!!!


Now, I am able to transfer the single file (whose name is known to me) from server to client after establish the FTP connection from client to server with the help of Lib Curl. The code is as follows,
#include <stdio.h>
#include <curl.h>
#include <types.h>
#include <easy.h>


  • This is an example showing how to get a single file from an FTP server.
  • It delays the actual destination file creation until the first write
  • callback so that it won’t create an empty file in case the remote file
  • doesn’t exist or something else fails.
    #define UPLOAD_FILE_AS “11.txt”

struct FtpFile
const char *filename;
FILE *stream;

static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream)
struct FtpFile *out=(struct FtpFile )stream;
if(out && !out->stream)
open file for writing /
out->stream=fopen(out->filename, “wb”);
return -1; /
failure, can’t open file to write */
return fwrite(buffer, size, nmemb, out->stream);

int main(void)
CURL curl;
CURLcode res;
struct FtpFile ftpfile={“11.txt”, NULL}; /
name to store the file as if succesful */
struct curl_slist *headerlist=NULL;
static const char buf_1 [] = "DELE " UPLOAD_FILE_AS;

curl = curl_easy_init();

	 * Get curl 7.9.2 from sunet.se's FTP site. curl 7.9.2 is most likely not
	 * present there by the time you read this, so you'd better replace the
	 * URL with one that works!
	headerlist = curl_slist_append(headerlist, buf_1);
	curl_easy_setopt(curl, CURLOPT_URL, REMOTE_URL);
	curl_easy_setopt (curl, CURLOPT_VERBOSE, 1);
	curl_easy_setopt (curl, CURLOPT_USERNAME , "gaurav");
	curl_easy_setopt (curl, CURLOPT_PASSWORD ,"gaurav");
	/* Define our callback to get called when there's data to be written */
	curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite);
	/* Set a pointer to our struct to pass to the callback */
	curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile);
	/* Switch on full protocol/debug output */
	curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
	curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist);
	res = curl_easy_perform(curl);
   	/* always cleanup */
	if(CURLE_OK != res) 
		/* we failed */
		fprintf(stderr, "curl told us %d\n", res);

	fclose(ftpfile.stream); /* close the local file */ 


return 0;


But my basic aim is to transfer all the file (whose ext is know to me, not the full file name) in one stroke from server to client.
Please help me to solve this issue.