cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: crash in windows

From: Surya Kiran Gullapalli <suryakiran.gullapalli_at_gmail.com>
Date: Tue, 27 Jun 2006 09:48:12 +0530

On 6/27/06, Surya Kiran Gullapalli <suryakiran.gullapalli_at_gmail.com> wrote:
>
> Hi,
> I'm a newbie to curl. I wrote a small program to download a webpage. The
> sample code is working fine in linux. But on windows, i'm getting a
> segmentation violation at curl_easy_perform.
>
> Please find the sample code here.
> ===================
> #include <curl/curl.h>
> #include <iostream>
> #include <string>
> using namespace std ;
>
> int main (void)
> {
> CURL *curl ;
> CURLcode res ;
>
> string file (" staban.html") ;
> char error [CURL_ERROR_SIZE] ;
>
> FILE *fp ;
> fp = fopen (file.c_str(), "w") ;
>
> curl = curl_easy_init() ;
> if (curl)
> {
> curl_easy_setopt(curl, CURLOPT_URL, " http://www.google.co.in") ;
> curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp) ;
> curl_easy_setopt(curl, CURLOPT_VERBOSE, 1) ;
> curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error) ;
> res = curl_easy_perform (curl) ;
> if (res)
> {
> cout << "******************************" << endl;
> cout << error << endl ;
> cout << "******************************" << endl;
> }
> curl_easy_cleanup(curl) ;
> }
>
>
> fclose(fp) ;
> return 0 ;
> }
> ===========================
> My network connection is thru proxy server. I did not explicitly set the
> proxy information in the code, but during run time, i set those environment
> variables on the command line and then run the program. As i've mentioned,
> I'm getting a seg fault at curl_easy_perform on windows. What am i doing
> wrong here?
>
> Thanks in advance,
> Surya
>

Hi,
forgot to give information.
I'm using curl-7.15.4, built on windows using MSVC-7.1 compiler. I'm _not_
using cygwin.

Surya
Received on 2006-06-27