Sample code for 30+ languages & platforms
C++

Example: Http.S3_FileExists method

Demonstrates the S3_FileExists method.

Chilkat C++ Downloads

C++
#include <CkHttp.h>

void ChilkatSample(void)
    {
    CkHttp http;

    //  Insert your AWS keys here:
    http.put_AwsAccessKey("AWS_ACCESS_KEY");
    http.put_AwsSecretKey("AWS_SECRET_KEY");

    const char *bucketName = "chilkat.ocean";
    const char *objectName = "seahorse.jpg";
    http.put_AwsRegion("us-west-2");
    http.put_AwsEndpoint("s3-us-west-2.amazonaws.com");

    int retval = http.S3_FileExists(bucketName,objectName);
    if (retval < 0) {
        std::cout << "Failed to check for the S3 object existence" << "\r\n";
        std::cout << http.lastErrorText() << "\r\n";
        return;
    }

    if (retval == 0) {
        std::cout << "The S3 object does not exist." << "\r\n";
        return;
    }

    std::cout << "The S3 object exists." << "\r\n";
    }