> -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Xu, > Qiang (FXSGSC) > Sent: Friday, October 23, 2009 5:54 PM > To: libcurl development > Subject: RE: libcurl and libssh2 > > For file download/upload, it can be achieved by a series of > curl_easy_setopt() and curl_easy_perform(). If the URL is > ended with a slash, curl_easy_setopt() and > curl_easy_perform() can also be used to fulfill the "ls" > task. But the result of curl_easy_perform() is CURLE_OK or > not. I can't see any way to retrieve the "ls" result from > this function. > > Or, to retrieve the "ls" result, is there any other func to use?
After some research, I feel that maybe curl_easy_setopt() and curl_easy_perform() still can be used without the need for any other func: ================================================================== /* from http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTWRITEDATA */ CURLOPT_WRITEDATA Data pointer to pass to the file write function. If you use the CURLOPT_WRITEFUNCTION option, this is the pointer you'll get as input. If you don't use a callback, you must pass a 'FILE *' as libcurl will pass this to fwrite() when writing data. The internal CURLOPT_WRITEFUNCTION will write the data to the FILE * given with this option, or to stdout if this option hasn't been set. If you're using libcurl as a win32 DLL, you MUST use the CURLOPT_WRITEFUNCTION if you set this option or you will experience crashes. This option is also known with the older name CURLOPT_FILE, the name CURLOPT_WRITEDATA was introduced in 7.9.7. ================================================================== If this option is set with a valid file pointer, I guess the "ls" result displayed in stdout will be redirected to the file. Next week, I'll try to write a small program to verify it. Regards, Xu Qiang ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
