xref: /aosp_15_r20/external/curl/docs/examples/README.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker<!--
2*6236dae4SAndroid Build Coastguard WorkerCopyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard Worker
4*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
5*6236dae4SAndroid Build Coastguard Worker-->
6*6236dae4SAndroid Build Coastguard Worker
7*6236dae4SAndroid Build Coastguard Worker# libcurl examples
8*6236dae4SAndroid Build Coastguard Worker
9*6236dae4SAndroid Build Coastguard WorkerThis directory is for libcurl programming examples. They are meant to show
10*6236dae4SAndroid Build Coastguard Workersome simple steps on how you can build your own application to take full
11*6236dae4SAndroid Build Coastguard Workeradvantage of libcurl.
12*6236dae4SAndroid Build Coastguard Worker
13*6236dae4SAndroid Build Coastguard WorkerIf you end up with other small but still useful example sources, please mail
14*6236dae4SAndroid Build Coastguard Workerthem for submission in future packages and on the website.
15*6236dae4SAndroid Build Coastguard Worker
16*6236dae4SAndroid Build Coastguard Worker## Building
17*6236dae4SAndroid Build Coastguard Worker
18*6236dae4SAndroid Build Coastguard WorkerThe `Makefile.example` is an example Makefile that could be used to build
19*6236dae4SAndroid Build Coastguard Workerthese examples. Just edit the file according to your system and requirements
20*6236dae4SAndroid Build Coastguard Workerfirst.
21*6236dae4SAndroid Build Coastguard Worker
22*6236dae4SAndroid Build Coastguard WorkerMost examples should build fine using a command line like this:
23*6236dae4SAndroid Build Coastguard Worker
24*6236dae4SAndroid Build Coastguard Worker    `curl-config --cc --cflags --libs` -o example-my example.c
25*6236dae4SAndroid Build Coastguard Worker
26*6236dae4SAndroid Build Coastguard WorkerSome compilers do not like having the arguments in this order but instead
27*6236dae4SAndroid Build Coastguard Workerwant you do reorganize them like:
28*6236dae4SAndroid Build Coastguard Worker
29*6236dae4SAndroid Build Coastguard Worker    `curl-config --cc` -o example-my example.c `curl-config --cflags --libs`
30*6236dae4SAndroid Build Coastguard Worker
31*6236dae4SAndroid Build Coastguard Worker**Please** do not use the `curl.se` site as a test target for your libcurl
32*6236dae4SAndroid Build Coastguard Workerapplications/experiments. Even if some of the examples use that site as a URL
33*6236dae4SAndroid Build Coastguard Workerat some places, it does not mean that the URLs work or that we expect you to
34*6236dae4SAndroid Build Coastguard Workeractually torture our website with your tests. Thanks.
35*6236dae4SAndroid Build Coastguard Worker
36*6236dae4SAndroid Build Coastguard Worker## Examples
37*6236dae4SAndroid Build Coastguard Worker
38*6236dae4SAndroid Build Coastguard WorkerEach example source code file is designed to be and work stand-alone and
39*6236dae4SAndroid Build Coastguard Workerrather self-explanatory. The examples may at times lack the level of error
40*6236dae4SAndroid Build Coastguard Workerchecks you need in a real world, but that is then only for the sake of
41*6236dae4SAndroid Build Coastguard Workerreadability: to make the code smaller and easier to follow.
42