2022-06-14 16:22:56 +08:00
|
|
|
<!--
|
2023-01-02 20:51:48 +08:00
|
|
|
Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
2022-06-14 16:22:56 +08:00
|
|
|
|
|
|
|
SPDX-License-Identifier: curl
|
|
|
|
-->
|
|
|
|
|
2020-09-30 20:56:08 +08:00
|
|
|
# libcurl examples
|
2000-09-21 06:32:08 +08:00
|
|
|
|
2002-06-19 20:37:02 +08:00
|
|
|
This directory is for libcurl programming examples. They are meant to show
|
|
|
|
some simple steps on how you can build your own application to take full
|
2000-09-21 06:32:08 +08:00
|
|
|
advantage of libcurl.
|
|
|
|
|
|
|
|
If you end up with other small but still useful example sources, please mail
|
2020-08-17 04:36:10 +08:00
|
|
|
them for submission in future packages and on the website.
|
2001-02-19 21:38:29 +08:00
|
|
|
|
2020-09-30 20:56:08 +08:00
|
|
|
## Building
|
2004-11-25 00:11:35 +08:00
|
|
|
|
2022-09-21 05:30:19 +08:00
|
|
|
The `Makefile.example` is an example Makefile that could be used to build
|
|
|
|
these examples. Just edit the file according to your system and requirements
|
|
|
|
first.
|
2001-03-27 17:10:53 +08:00
|
|
|
|
2002-01-16 22:13:54 +08:00
|
|
|
Most examples should build fine using a command line like this:
|
|
|
|
|
2020-09-30 20:56:08 +08:00
|
|
|
`curl-config --cc --cflags --libs` -o example example.c
|
2002-01-16 22:13:54 +08:00
|
|
|
|
2021-10-31 23:34:44 +08:00
|
|
|
Some compilers do not like having the arguments in this order but instead
|
2002-08-15 07:01:14 +08:00
|
|
|
want you do reorganize them like:
|
|
|
|
|
2020-09-30 20:56:08 +08:00
|
|
|
`curl-config --cc` -o example example.c `curl-config --cflags --libs`
|
2002-08-15 07:01:14 +08:00
|
|
|
|
2022-09-19 23:30:30 +08:00
|
|
|
**Please** do not use the `curl.se` site as a test target for your libcurl
|
|
|
|
applications/experiments. Even if some of the examples use that site as a URL
|
|
|
|
at some places, it does not mean that the URLs work or that we expect you to
|
|
|
|
actually torture our website with your tests. Thanks.
|
2004-11-25 00:11:35 +08:00
|
|
|
|
2020-09-30 20:56:08 +08:00
|
|
|
## Examples
|
2004-11-25 00:11:35 +08:00
|
|
|
|
2015-11-25 17:49:22 +08:00
|
|
|
Each example source code file is designed to be and work stand-alone and
|
|
|
|
rather self-explanatory. The examples may at times lack the level of error
|
|
|
|
checks you need in a real world, but that is then only for the sake of
|
|
|
|
readability: to make the code smaller and easier to follow.
|