Sample code for 30+ languages & platforms
Unicode C

Example: Http.S3_FileExists method

Demonstrates the S3_FileExists method.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkHttpW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    const wchar_t *bucketName;
    const wchar_t *objectName;
    int retval;

    http = CkHttpW_Create();

    //  Insert your AWS keys here:
    CkHttpW_putAwsAccessKey(http,L"AWS_ACCESS_KEY");
    CkHttpW_putAwsSecretKey(http,L"AWS_SECRET_KEY");

    bucketName = L"chilkat.ocean";
    objectName = L"seahorse.jpg";
    CkHttpW_putAwsRegion(http,L"us-west-2");
    CkHttpW_putAwsEndpoint(http,L"s3-us-west-2.amazonaws.com");

    retval = CkHttpW_S3_FileExists(http,bucketName,objectName);
    if (retval < 0) {
        wprintf(L"Failed to check for the S3 object existence\n");
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        return;
    }

    if (retval == 0) {
        wprintf(L"The S3 object does not exist.\n");
        CkHttpW_Dispose(http);
        return;
    }

    wprintf(L"The S3 object exists.\n");


    CkHttpW_Dispose(http);

    }