cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Downloading & saving a file in vbnet.

From: Allen Pulsifer <pulsifer3_at_comcast.net>
Date: Wed, 4 Jul 2007 08:58:36 -0400

CURLOPT_WRITEDATA takes a FILE handle, not a file name. In the C language,
a file handle is created by opening the file using the function "fopen" in
the C run-time library. In order to use CURLOPT_WRITEDATA, you need to
first open the file using a VBNet function that returns a C-compatible file
handle, or you need to open the file using some function that returns a
different type of handle, and then convert that handle to a C-compatible
file handle. I'm not a VBNet programmer so I don't know what those
functions might be. You might in the end decide its simply easier to open
and write the file yourself using the CURLOPT_WRITEFUNCTION.

> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Nico Alberti
> Sent: Wednesday, July 04, 2007 8:22 AM
> To: libcurl development
> Subject: Downloading & saving a file in vbnet.
>
>
> Hi all.
>
> I am trying to download and save a file using libcurl in
> vbnet, and I am trying to tweak the easyget sample basically
> not setting CURLOPT_WRITEFUNCTION and instead setting
> CURLOPT_WRITEDATA to the file name I want my data downloaded to:
>
> Ret = easy.SetOpt(CURLoption.CURLOPT_WRITEDATA, "C:\path\to\FileName")
>
> I am not a C programmer (actually I am not a programmer at
> all :-) ), and this is what I understood from the man pages,
> but I am probably missing something. I could use a global
> variable and feed it in a custom write function, but I would
> really like to use a less sloppy approach.
>
> Thank you in advance, and sorry for my bad English.
> --
> Ciao
> Nico
Received on 2007-07-04