curl-library
Establish the FTP Connection and file Transfer from on location to other
Date: Tue, 6 Apr 2010 10:03:41 +0530
Hi,
My aim is to establish the FTP connection and transfer the file from one
location to other on QNX.
The code that i have written is
#include <stdio.h>
#include <unistd.h>
#include <curl.h>
#include <cstdlib>
#include <iostream>
int main(int argc, char **argv)
{
int return_global_init;
CURL *curl;
//CURLcode res;
return_global_init=curl_global_init(CURL_GLOBAL_ALL);
struct curl_slist *slist=NULL;
slist = curl_slist_append(slist, "put");
// slist = curl_slist_append(slist, "pwd");
// slist = curl_slist_append(slist, "pwd");
// slist = curl_slist_append(slist, "chmod 777 11.txt");
// slist = curl_slist_append(slist, "GK");
//slist = curl_slist_append(slist, "TO");
// slist = curl_slist_append(slist, "22.txt");
if (return_global_init==0)
{
curl = curl_easy_init();
if (curl)
{
std::cout << "Error No - 1" << curl_easy_setopt
(curl, CURLOPT_URL, "ftp://172.29.59.216")<< std::endl;
std::cout << "Error No - 2" << curl_easy_setopt
(curl, CURLOPT_VERBOSE, 1)<< std::endl;
std::cout << "Error No - 3" << curl_easy_setopt
(curl, CURLOPT_USERNAME , "gaurav")<< std::endl;
std::cout << "Error No - 4" << curl_easy_setopt
(curl, CURLOPT_PASSWORD ,"gaurav")<< std::endl;
//curl_easy_setopt (curl, CURLOPT_FTP_USE_EPSV,
0);
//curl_easy_setopt (curl, CURLOPT_FTP_USE_EPRT,
0);
curl_easy_setopt (curl, CURLOPT_USE_SSL,
CURLUSESSL_TRY);
curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER,
0);
curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST,
0);
std::cout << "Error No - 5" << curl_easy_setopt
(curl, CURLOPT_QUOTE , slist) << std::endl;
curl_easy_perform(curl);
curl_easy_setopt(curl, CURLOPT_POSTQUOTE, slist);
}
}
}
But it is not giving me proper output.
Any help in finding a solution would be greatly appreciated.!!!!!!!!!
Regards,
Amol Raoji Madane
Tata Consultancy Services
DLF Akruti Info Park,
PN 28,
Rajiv Gandhi Infotech Park Hinjewadi, PHASE II
Pune - 411057,Maharashtra
India
Ph:- +91-20-6675-2352
Buzz:- 420-2352
Mailto: amol.madane_at_tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Outsourcing
____________________________________________
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-06