cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: ftpupload.c example

From: Guenter Knauf <eflash_at_gmx.net>
Date: Tue, 19 Feb 2008 04:44:49 +0100

Hi,
> Tnx for the wuick response, after doing so, I get a warning messages...

> --------------------Configuration: ftpupload - Win32
> Debug--------------------
> Compiling...
> ftpupload.c
> E:\curlcpp\libcurl-msvc\docs\examples\ftpupload.c(46) : warning C4013:
> '_open' undefined; assuming extern returning int
> E:\curlcpp\libcurl-msvc\docs\examples\ftpupload.c(48) : warning C4013:
> '_close' undefined; assuming extern returning int

> ftpupload.obj - 0 error(s), 2 warning(s)

> And when I run the program, it crashes giving me a pop up saying
> "ftpupload.exe has encountered a problem and needs to close. We are sorry
> for the inconvenience." BTW here's the code of line (46) and (48)

> /* get the file size of the local file */
> hd = open(LOCAL_FILE, O_RDONLY) ;
> fstat(hd, &file_info);
> close(hd) ;

then try something like that:

#ifdef WIN32
#define open _open
#define close _close
#include <io.h>
#else
#include <unistd.h>
#endif

Guenter.
Received on 2008-02-19