Sample code for 30+ languages & platforms
Unicode C

S3 List Buckets

See more Amazon S3 Examples

Demonstrates how to retrieve the XML listing the buckets for an Amazon S3 account.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkHttpW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    const wchar_t *xmlStr;

    //  This example requires the Chilkat API to have been previously unlocked.
    //  See Global Unlock Sample for sample code.

    http = CkHttpW_Create();

    //  Insert your access key here:
    CkHttpW_putAwsAccessKey(http,L"AWS_ACCESS_KEY");

    //  Insert your secret key here:
    CkHttpW_putAwsSecretKey(http,L"AWS_SECRET_KEY");

    xmlStr = CkHttpW_s3_ListBuckets(http);

    if (CkHttpW_getLastMethodSuccess(http) != TRUE) {
        //  Failed
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
    }
    else {
        //  Success.  Show the XML response.  (Use the online tool at the link below to generate parsing code.)
        wprintf(L"%s\n",xmlStr);
    }

    //  Use this online tool to generate parsing code from sample XML: 
    //  Generate Parsing Code from XML


    CkHttpW_Dispose(http);

    }