Thread: C++ and Hardware UPC Reader

  1. #1
    Registered User
    Join Date
    Jun 2006

    C++ and Hardware UPC Reader


    I was wondering that if I got one of those UPC reader things that are always at stores' checkout counters, and I hooked it up to my computer, how could I write a program with C++ that reads the barcodes and returns with a message, depending on what the barcode reads? How would I tell the computer to read from the hardware?



  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Banks of the River Styx

    The code written will vary, depending on what OS you're using, and what type of UPC reader you get. (ie, USB, serial port, etc?) Hopefully it comes with a manual describing what data to send to it, etc, or perhaps there is one at it's website.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001
    Yeah.... You'll have to get that information from the hardware manufacturer. What's the interface?

    There are two common situations with hardware:

    1- The manufacturer supplies the hardware, driver, and software together as a package. They don't disclose how to interface with it.

    2- The manufacturer supplies a driver and software library that can be used with your C/C++ compiler. They don't disclose the low-level interface information... you have to communicate through the driver.

    In the case of common peripherals like printers, the driver and firmware are proprietary, but they don't need to supply a software library because the operating system has a standard way of communicating with the driver. As long as you have a library for the particular O.S. (i.e. the WIN32 API) you can communicate with any printer driver.

    In rare cases, the manufacturer might supply the information on how to communicate with the actual hardware and it's internal firmware. In the "old days", printer manufactures would publish this information. But, now you need the driver... i.e. you generally can't write your own printer driver.
    Last edited by DougDbug; 07-12-2006 at 01:52 PM.

Popular pages Recent additions subscribe to a feed