As you might have heard, Bracode readers are special input devices for computers to read barcode. Barcode reader first scan the barcode using a light beam( usually a laser beam ) and analyze the width and distance between the bars. After successful scanning it convert the data into ASCII code which can be decoded by our computer. Simply we can say, a ps/2 barcode reader is same as that of a keyboard. Both generates the same ASCII code for representing an alphanumeric character. For more about ascii, read my article.
A ps/2 barcode readrer is the simplest at the same time more efficient for general purposes. In C++ the header file iostream.h defines cin, cout commands for standard input and output operations respectively. As default, keyboard is the standard input device. Since our ps/2 barcode reader can act as an alternative keyboard by reading and sending ASCII codes to the computer, surely we can use our cin command for data input.
I hope it is clear for you now. For further study, Let’s just analyze the below situation. Imagine you have a barcode containing data ‘1001’. When you scan it with barcode reader it generates a signal in ASCII code and send it to computer in the same way when you press ‘1001’ using your keyboard. The computer can’t distinguish from where the data came. So further processes can be programmed as our intentions.
There are a lot of type barcode readers. For general purposes like supermarket, library programs, i recommend ps/2 barcode reader which can be used along with our keyboard. let’s just take a sample c++ program to read from barcode reader.
#include<iostream> #include<conio.h> using namespace std; void main() { int a = 0; //Scan a barcode (simple barcode containing a number ). Don't use keyboard cin >> a; if (a) { cout << "n Data Received !n" << "Barcode is :" << a; } return; }
Suggested Read : The Quick Response Codes
… [Trackback]
[…] Information to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Find More Information here on that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] There you will find 64110 more Info on that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Here you can find 13643 additional Info to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Read More on that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] There you will find 20087 more Information on that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Read More on to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Find More on that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Find More here to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] There you can find 32836 additional Information on that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Information to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] There you can find 65888 more Info on that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Here you will find 21828 additional Info to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Find More to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Read More on that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] There you will find 57519 more Information to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Read More Information here to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Here you can find 18241 additional Information to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Read More here to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Here you will find 65386 additional Info to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Info to that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]
… [Trackback]
[…] Read More on on that Topic: genuinecoder.com/using-barcode-reader-for-your-c-program-html/ […]