> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of
> Daniel Stenberg
> Sent: Wednesday, November 11, 2009 3:10 AM
> To: libcurl development
> Subject: Re: response to quoted pwd command in libcurl
>
> On Tue, 10 Nov 2009, Xu, Qiang (FXSGSC) wrote:
>
> > The command seems to be successful, but I can only see the
> > destination directory's content listing. How can I retrieve the
> > result of the quoted command "pwd", both by curl command
> > and by libcurl?
>
> It is sent as a header, so use the header callback for that.
I've written a small program to do the test. Here is the code:
===================================================
#include <stdio.h>
#include <curl/curl.h>
#include <time.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd = curl_easy_init();
FILE *fDownload = NULL;
FILE *fHeader = NULL;
struct curl_slist *headers = NULL;
if ((fDownload = fopen("./downloadFile", "w")) == NULL)
{
printf("can't open output file");
return -1;
}
if ((fHeader = fopen("./headerFile", "w")) == NULL)
{
printf("can't open output file");
return -1;
}
headers = curl_slist_append(headers, "pwd");
curl_easy_setopt(hnd, CURLOPT_QUOTE, headers);
curl_easy_setopt(hnd, CURLOPT_WRITEHEADER, fHeader);
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, fDownload);
curl_easy_setopt(hnd, CURLOPT_HEADER, 1);
curl_easy_setopt(hnd, CURLOPT_URL, "sftp://13.198.98.190/~/scan/");
curl_easy_setopt(hnd, CURLOPT_USERPWD, "qxu:fair123");
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1);
ret = curl_easy_perform(hnd);
curl_slist_free_all(headers);
curl_easy_cleanup(hnd);
return (int)ret;
}
===================================================
To my dismay, the feedback to the quoted command "pwd" is not written into "./headerFile", while the directory's content is listed in "./downloadFile". What shall I do to make the feedback go into the output file?
Looking forward to help,
Xu Qiang
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-12