DTWAIN_ArrayFindString |
Top Previous Next |
The DTWAIN_ArrayFindString function searches for a string value in a DTWAIN_ARRAY.
LONG DTWAIN_ArrayFindString (
Parameters Array DTWAIN_ARRAY to search.
Value String 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.
Character specific version
Comments DTWAIN_ArrayFindString is a specialized version of DTWAIN_ArrayFind for string values.
The DTWAIN_ArrayFindString function searches the DTWAIN_ARRAY Array, and returns the position of the first element that is equal to string pointed to by Value. Note that the string Value must be a null-terminated string.
This function will only work for DTWAIN_ARRAY's that can store string values (i.e. the DTWAIN_ARRAY was created with the DTWAIN_ARRAYSTRING 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; char Str1[] = "Test1"; char Str2[] = "Test2";
/* Create a DTWAIN_ARRAY with 4 elements */ Array = DTWAIN_ArrayCreate(DTWAIN_ARRAYSTRING, 2);
DTWAIN_ArraySetAtString( Array, 0, Str1 ) DTWAIN_ArraySetAtString( Array, 1, Str2 )
/* Search for 2 */ Position = DTWAIN_ArrayFindString( Array, Str1 );
/* Position should be a 0, since the "Test1" was stored at Array[0] */
/* Destroy the array */ DTWAIN_ArrayDestroy( Array ); }
TWAIN State Transitions None.
Prerequisite Function Call(s)
See Also |