Home > Net >  USB Barcode Scanner with C Console Program
USB Barcode Scanner with C Console Program

Time:10-31

I know this isn't exactly a programming question, but it is related:

I'd like to know if USB barcode scanners can scan a barcode and type the results as if it was a keyboard. The reason for this is that I would like to make a C console application that will take the input of the scanner using cin or getline, but that would only work if the barcode scanner types the results into my program like a keyboard, and I would like the scanner to press enter for me so I can just scan and scan without pressing it myself in between.

If it doesn't work like that, then how can I get the barcode scanner to give the variable with the results to my program? Is there a special cheap barcode scanner with a C api?

I would test this myself, but I am a teen with no money and I don't want to bother my parents for a scanner just to waste their money if it doesn't work.

EDIT: If there is some 3rd party api thing, I don't want to have to type so much confusing code, I would just like to type something like: barcodeResults = scanBarcodeAPI();

CodePudding user response:

All the barcode scanners I've dealt with have emulated a keyboard. (In fact, a more common question seems to be how to distinguish scanner input from keyboard input. For example, see How do I tell if keyboard input is coming from a barcode scanner?)

Having the scanner add <ENTER> to the end of the barcode is a common configuration (of the scanner).

  • Related