cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Example Http Get File in C

From: Brian Dessent <brian_at_dessent.net>
Date: Fri, 17 Feb 2006 15:51:22 -0800

> herzausgold wrote:

> If I remember correctly strdup() is not supported by some compilers.

It has nothing to do with the compiler and everything to do with the C
library -- they are often entirely different entities. Besides,
SUSv3/Posix requires strdup() so any libc lacking it is nonconforming.
Even MSVCRT, which is otherwise extremely lacking in posix conformance
has it.

> And sometimes strdup is in string.h while strcpy and other stuff is in
> stdio.h.

Both ISO/IEC-9899 (aka C99) and SUSv3 require strcpy() to be defined in
string.h. If you found a libc where this were not the case it would be
a seriously broken implementation. Even if it were, it would be
completely natural and common to include both.

> And having this functions it's easy to do some logging or debugging
> or write a memory allocator.

Be that as it may, it's completely unrelated to libcurl. Having
extraneous wrapper functions just clouds the purpose of the example,
which is to show the reader how to use libcurl.

Brian
Received on 2006-02-18