DTWAIN_ArrayGetBuffer

Top  Previous  Next

The DTWAIN_ArrayGetBuffer function returns a pointer to the internal DTWAIN_ARRAY buffer.

 

LPVOID DTWAIN_ArrayGetBuffer ( DTWAIN_ARRAY Array, LONG Offset )

 

Parameters

Array

DTWAIN_ARRAY used to get the buffer pointer.


Offset

Offset within the buffer to get a pointer to.


 

Return Values

If the function succeeds, returns a pointer to the internal array buffer of the DTWAIN_ARRAY, starting at offset Offset.  If the function fails, a NULL pointer is returned.

 

Comments

The DTWAIN_ArrayGetBuffer is used to get a pointer to the internals of the DTWAIN_ARRAY buffer.  Note that this function exists only for the purpose of reading and writing to the internal buffer.  Resizing the buffer will result in undefined behavior.


This function would mostly be used for C or C++ programs that want to read directly from the internal buffer.  For example, to get a pointer to the start of the internal buffer of a DTWAIN_ARRAY that represents LONG values:


DTWAIN_ARRAY a = DTWAIN_ArrayCreate(DTWAIN_ARRAYLONG, 10);

LONG* ptr = (LONG *)DTWAIN_ArrayGetBuffer(a, 0); // Gets the start of the buffer

//

s// ptr[0] is the first element, ptr[1] is the second element, etc.

 

Note that no check is made to see if the buffer is overrun or corrupted by the application.  Use this function with caution.


TWAIN State Transitions

None.

 

Prerequisite Function Call(s)

DTWAIN_SysInitialize

 

See Also

Retrieving Values from a DTWAIN_ARRAY