Sample code for 30+ languages & platforms
Unicode C Requires Chilkat v11.7.0+

Get the QR Code Capabilities of the Chilkat Version in Use

See more QR Code Examples

Demonstrates the capabilities operation, which describes what the installed version of Chilkat can do: the range of QR versions, the error-correction levels, the operations, the image formats and the limits. A program can check for a feature here instead of testing for a Chilkat version number. The request can be an empty JSON object.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkJsonObjectW.h>
#include <C_CkFormatsW.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkJsonObjectW json;
    HCkFormatsW fmt;
    HCkJsonObjectW jsonOut;
    int i;
    int n;

    success = FALSE;

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

    json = CkJsonObjectW_Create();
    fmt = CkFormatsW_Create();
    jsonOut = CkJsonObjectW_Create();
    success = CkFormatsW_QrCode(fmt,L"capabilities",json,jsonOut);
    if (success == FALSE) {
        wprintf(L"%s\n",CkFormatsW_lastErrorText(fmt));
        CkJsonObjectW_Dispose(json);
        CkFormatsW_Dispose(fmt);
        CkJsonObjectW_Dispose(jsonOut);
        return;
    }

    wprintf(L"Chilkat version: %s\n",CkJsonObjectW_stringOf(jsonOut,L"productVersion"));
    wprintf(L"symbology: %s\n",CkJsonObjectW_stringOf(jsonOut,L"symbologies[0].id"));
    wprintf(L"QR versions: %d to %d\n",CkJsonObjectW_IntOf(jsonOut,L"symbologies[0].encoding.version.min"),CkJsonObjectW_IntOf(jsonOut,L"symbologies[0].encoding.version.max"));
    wprintf(L"structured append, most symbols: %d\n",CkJsonObjectW_IntOf(jsonOut,L"symbologies[0].structuredAppend.maxSymbols"));

    n = CkJsonObjectW_SizeOfArray(jsonOut,L"symbologies[0].encoding.errorCorrection");
    for (i = 0; i <= n - 1; i++) {
        CkJsonObjectW_putI(jsonOut,i);
        wprintf(L"error correction: %s\n",CkJsonObjectW_stringOf(jsonOut,L"symbologies[0].encoding.errorCorrection[i]"));
    }

    //  The operations this version implements.
    n = CkJsonObjectW_SizeOfArray(jsonOut,L"operations");
    for (i = 0; i <= n - 1; i++) {
        CkJsonObjectW_putI(jsonOut,i);
        if (CkJsonObjectW_BoolOf(jsonOut,L"operations[i].available") == TRUE) {
            wprintf(L"operation: %s\n",CkJsonObjectW_stringOf(jsonOut,L"operations[i].name"));
        }

    }

    n = CkJsonObjectW_SizeOfArray(jsonOut,L"imageFormats.output");
    for (i = 0; i <= n - 1; i++) {
        CkJsonObjectW_putI(jsonOut,i);
        wprintf(L"image format: %s\n",CkJsonObjectW_stringOf(jsonOut,L"imageFormats.output[i]"));
    }

    wprintf(L"default timeout: %d ms\n",CkJsonObjectW_IntOf(jsonOut,L"limits.timeoutMs.default"));
    wprintf(L"default largest image: %d pixels\n",CkJsonObjectW_IntOf(jsonOut,L"limits.maxPixels.default"));

    //  Sample output:

    //  Chilkat version: 11.7.0
    //  symbology: qr
    //  QR versions: 1 to 40
    //  structured append, most symbols: 16
    //  error correction: auto
    //  error correction: L
    //  error correction: M
    //  error correction: Q
    //  error correction: H
    //  operation: generate
    //  operation: measure
    //  operation: validate
    //  operation: capabilities
    //  image format: png
    //  image format: svg
    //  default timeout: 10000 ms
    //  default largest image: 16777216 pixels


    CkJsonObjectW_Dispose(json);
    CkFormatsW_Dispose(fmt);
    CkJsonObjectW_Dispose(jsonOut);

    }