i'm writing a program using C++ that finds an object on a video, then the user must scan, with a barcode reader, some code in a list, then if the code is correct, the information is sent to a table in MySql.
i am stuck in the part of waiting for the user to scan the barcode. if i use a loop then the program gets frezed, so maybe i must wait for some keyboard event(because the barcode behaves like it), but this function can't continue if the code hasn't been readed.
so any one can point me what is the best way to do it?..
If your barcode scanner is attached as a keyboard as many of them are, then you need asynchronous IO. Here is example how to read from keyboard without blocking.