Click or drag to resize

ArrayStoreT Function (Array OfT, T, DWord)

X#
Store an array to a buffer.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION ArrayStore<T>(
	aSource AS ARRAY OF<T>,
	Buff AS T*,
	dwLen AS DWORD
)
 AS DWORD
Request Example View Source

Parameters

aSource
Type: Array OfT
The array to be stored to a buffer.
Buff
Type: T*
A pointer to the buffer.
dwLen
Type: DWord
The length of the buffer.

Type Parameters

T
The type of the array elements

Return Value

Type: DWord
The number of bytes stored to the buffer.
Remarks
Stores the contents of an array into the buffer pointed by Buff. You should insure that the buffer is allocated and is large enough before writing to it.
Examples
This example writes an array's elemental values to a buffer.
A DIM array serves as the destination pointer:
X#
 1FUNCTION Start()
 2    LOCAL DIM aDestination[4] AS USUAL
 3    LOCAL aList[4]
 4    ArrayPut(aList, 1, 1)
 5    ArrayPut(aList, 2, 3)
 6    ArrayPut(aList, 3, 5)
 7    ArrayPut(aList, 4, 7)
 8    ArrayStore(aList, @aDestination, 4*6)
 9    ? aDestination[1]        // Result: 1
10    ? aDestination[2]        // Result: 3
11    ? aDestination[3]        // Result: 5
12    ? aDestination[4]        // Result: 7
See Also