Create an EAN-13 Barcode in C/C++

If your company sells products in Europe, you need an easy and efficient process to create an EAN-13 barcode, which is the European equivalent to the North American UPC-A barcode. By utilizing the following API in C/C++, you will be able to automatically validate and generate a PNG file of an EAN-13 barcode.

You can kick off the process by installing libcurl:


Now, you can call the function by entering the barcode value and API key into the following example code:

CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
headers = curl_slist_append(headers, "Apikey: YOUR-API-KEY-HERE");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "0=%3C&1=s&2=t&3=r&4=i&5=n&6=g&7=%3E";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);

Done! To obtain an API key, head to the Cloudmersive website to register for a free account; this provides 800 calls/month across any of our APIs.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.