C Language Development Kit/Snippets/Input/ScanBarcode

From OptiWiki

Jump to: navigation, search
Description Inputs a string of data by scanning a barcode.
Syntax
int ScanBarcode( char *string, int min_length, int max_length );
Arguments
char *string

Holds the scanned barcode.

int min_length

The minimal length the scanned barcode at least needs to have.

int max_length

The maximum length the scanned barcode may have.

Returns
OK On success.
ERROR Aborted by pressing another key then the TRIGGER key.
Remarks None.
Example
#include "lib.h"
#include <stdio.h>
#include "input.h"  //Holds the input functions
 
void main( void )
{
    char string[ 46 ];
    for(;;)
    {
        printf("\fScan barcode..\n");
        while( ScanBarcode( string, 1, 40 ) != OK )
            continue;
 
        printf("\fscanned:\n%s\npress a key\nto continue", string);
        WaitForKey();
    }
}


Views
Personal tools