ByteScout Barcode Reader SDK - C++ (Unmanaged) - General Example Reading Barcode - ByteScout

ByteScout Barcode Reader SDK – C++ (Unmanaged) – General Example Reading Barcode

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – C++ (Unmanaged) – General Example Reading Barcode

general example reading barcode in C++ (Unmanaged) using ByteScout BarCode Reader SDK

Write code in C++ (Unmanaged) to make general example reading barcode with this How-To tutorial

The documentation is designed to help you to implement the features on your side. ByteScout BarCode Reader SDK was made to help with general example reading barcode in C++ (Unmanaged). ByteScout BarCode Reader SDK is the SDK for reading of barcodes from PDF, images and live camera or video. Almost every common type like Code 39, Code 128, GS1, UPC, QR Code, Datamatrix, PDF417 and many others are supported. Supports noisy and defective images and docs. Includes optional documents splitter and merger for pdf and tiff based on found barcodess. Batch mode is supported for superior performance using multiple threads. Decoded values are easily exported to JSON, CSV, XML and to custom format.

The SDK samples like this one below explain how to quickly make your application do general example reading barcode in C++ (Unmanaged) with the help of ByteScout BarCode Reader SDK. Follow the instruction from the scratch to work and copy and paste code for C++ (Unmanaged) into your editor. Enjoy writing a code with ready-to-use sample C++ (Unmanaged) codes to add general example reading barcode functions using ByteScout BarCode Reader SDK in C++ (Unmanaged).

Our website provides free trial version of ByteScout BarCode Reader SDK. It comes along with all these source code samples with the goal to help you with your C++ (Unmanaged) application implementation.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

CommonExample.cpp
      
#include "stdafx.h" #import "c:\\Program Files\\Bytescout BarCode Reader SDK\\net2.00\\Bytescout.BarCodeReader.tlb" raw_interfaces_only using namespace Bytescout_BarCodeReader; int _tmain(int argc, _TCHAR* argv[]) { // Initialize COM. HRESULT hr = CoInitialize(NULL); // Create the interface pointer. IReaderPtr pIReader(__uuidof(Reader)); // set the registration name and key _bstr_t registrationName(L"DEMO"); pIReader->put_RegistrationName(registrationName); _bstr_t registrationKey(L"DEMO"); pIReader->put_RegistrationKey(registrationKey); // Set barcode type to find _BarcodeTypeSelectorPtr pBarcodeTypesToFind; pIReader->get_BarcodeTypesToFind(&pBarcodeTypesToFind); pBarcodeTypesToFind->put_GS1DataBarExpanded(VARIANT_TRUE); // Get full path of sample barcode image file WCHAR file[MAX_PATH]; ::GetFullPathName(L"GS1DataBarExpanded.png", MAX_PATH, file, NULL); // Read barcode from file hr = pIReader->ReadFromFile(_bstr_t(file)); // check if file was not found if (hr == E_FAIL) { wprintf(L"File was not found: %s\n", file); } else { // Get found barcode count long count; pIReader->get_FoundCount(&count); // Get found barcode information for (int i = 0; i < count; i++) { SymbologyType type; hr = pIReader->GetFoundBarcodeType(i, &type); wprintf(L"Barcode type: %d\n", type); float confidence; hr = pIReader->GetFoundBarcodeConfidence(i, &confidence); wprintf(L"Barcode confidence: %f\n", confidence); BSTR bstrValue; hr = pIReader->GetFoundBarcodeValue(i, &bstrValue); wprintf(L"Barcode value: %s\n", bstrValue); ::SysFreeString(bstrValue); wprintf(L"\n"); } if (count == 0) { wprintf(L"No barcodes found."); } } // Uninitialize COM. CoUninitialize(); // Wait until user press any key system("pause"); return 0; }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

stdafx.cpp
      
// stdafx.cpp : source file that includes just the standard includes // BarcodeReaderExample.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

stdafx.h
      
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include <stdio.h> #include <tchar.h>

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next