Example
#include <conio.h> #include <stdio.h> #include "mmsultra.h"
void main(void) |
|
{ | // Command calls status |
short sStatus = 0; | |
char cBuffer[50]; | // Application buffer |
int iInput = 0; | // Trigger input |
sStatus = scnOpenScanner(); | // Enable scanner |
if (sStatus == |
|
printf("Scanner open | |
else { | // Perform scan |
printf("Press trigger to scan...\n"); | |
iInput = _getch(); |
|
if (iInput == 0) { |
|
iInput = _getch(); |
|
if (iInput == 0x85) { |
|
sStatus = scnTrigger(1); |
|
if (sStatus != 0) |
|
printf("Scanner trigger | |
else |
|
{ | // Beep for success |
spkBeep(1, 1000); | |
| // Retrieve data |
sStatus = scnGetScannedData(cBuffer); | |
if (sStatus <= 0) |
|
printf("Error retrieving scanner | |
else | // Get bar code type |
{ | |
sStatus = scnGetBarCodeType(); | |
printf("Bar code is a %d", sStatus); | |
} |
|
} |
|
} |
|
} |
|
} | // Disable scanner |
sStatus = scnCloseScanner(); | |
} |
|