cURL / Mailing Lists / curl-library / Single Mail


FTP upload from NT.

From: Alexander Krasnostavsky <>
Date: Sun, 4 Jul 2004 10:17:28 +0300


I am working with version curl-7.12.1-20040617
The following code is working on UNIX but failed to upload a file from
NT using FTP.
The failure is in lib/sendf.c in Curl_read() in line 423:
nread = sread(sockfd, buf, buffersize);

I found that when libcurl compiled with _MT option, fread() try to lock
the file:
_lock_str(stream); /* lock stream */

And I get "Access violation writing location 0x00000010" error.
Does somebody have solution for it?

int main (int argc, char* args[]) {
        CURL *curl;
        CURLcode res;
        char error_buffer[ CURL_ERROR_SIZE + 1 ] = "";
        char url[300];
        FILE *hd_src = fopen("C:\\FTG\\CurlPull.dat", "rb");
        if (hd_src == NULL) {
                fprintf(stderr, "fopen() failed.\n");
                return -1;
        curl = curl_easy_init();
        if (curl) {
                curl_easy_setopt(curl, CURLOPT_ERRORBUFFER,
                sprintf(url, "ftp://%s@%s/%s", USERPASS, HOST,
                printf("%s\n", url);
                curl_easy_setopt(curl, CURLOPT_URL, url);
                curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE);
                curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);
                curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
                res = curl_easy_perform(curl);
                if(CURLE_OK != res) {
                        fprintf(stderr, "curl told us %d\n%s\n", res,
        return 0;

The information contained in this message is proprietary of Amdocs,
protected from disclosure, and may be privileged.
The information is intended to be conveyed only to the designated recipient(s)
of the message. If the reader of this message is not the intended recipient,
you are hereby notified that any dissemination, use, distribution or copying of
this communication is strictly prohibited and may be unlawful.
If you have received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.
Thank you.
Received on 2004-07-04