DTWAIN_ArrayFindLong |
Top Previous Next |
The DTWAIN_ArrayFindLong function searches for a LONG value in a DTWAIN_ARRAY.
LONG DTWAIN_ArrayFindLong (
Parameters Array DTWAIN_ARRAY to search.
Value LONG value to search for
Return Values If the function succeeds, the zero-based position of the element is returned. Otherwise -1 is returned if the element cannot be found, or another error has been encountered.
Comments DTWAIN_ArrayFindLong is a specialized version of DTWAIN_ArrayFind for LONG values.
The DTWAIN_ArrayFindLong function searches the DTWAIN_ARRAY Array, and returns the position of the first element that is equal to Value.
This function will only work for DTWAIN_ARRAY's that can store LONG values (i.e. the DTWAIN_ARRAY was created with the DTWAIN_ARRAYLONG style. See DTWAIN_ArrayCreate for more information).
Example: /* Find an element in a DTWAIN_ARRAY */ void Func( ) { DTWAIN_ARRAY Array; LONG i; LONG Position; LONG SearchVal;
/* Create a DTWAIN_ARRAY with 4 elements */ Array = DTWAIN_ArrayCreate(DTWAIN_ARRAYLONG, 4);
/* Store the values 0, 2, 4, and 6 in the DTWAIN_ARRAY */ for ( i = 0; i < 4; i++ ) DTWAIN_ArraySetAtLong( Array, i, i*2 )
/* Search for 2 */ Position = DTWAIN_ArrayFindLong( Array, 2 );
/* Position should be a 1, since the '2' was stored at Array[1] */
/* Search for 6 */ Position = DTWAIN_ArrayFindLong( Array, 6 );
/* Position should be a 3, since the '6' was stored at Array[3] */
/* Destroy the array */ DTWAIN_ArrayDestroy( Array ); }
TWAIN State Transitions None.
Prerequisite Function Call(s)
See Also |