Click or drag to resize

MemShort Function

Get a pointer to a matching short integer in a memory buffer.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.4a
Syntax
 FUNCTION MemShort(
	ptrBuffer AS IntPtr,
	siValue AS SHORT,
	dwCount AS DWORD
) AS IntPtr
View Source

Parameters

ptrBuffer
Type: IntPtr
A pointer to the memory buffer to examine.
siValue
Type: Int16
The short integer value to match.
dwCount
Type: UInt32
The number of short integers in <ptrBuffer> to examine.

Return Value

Type: IntPtr
A pointer to the first occurrence of <siValue> within the first <dwCount> short integers of  <ptrBuffer>.
If <siValue> is not matched, MemShort() returns a NULL_PTR.
Remarks
Examples
This example uses MemShort() on a PSZ:
X#
1FUNCTION StartShort()
2    LOCAL ptrSI := "ABCDEFGHIJ" AS PSZ
3    // Note: short integer translation of "AB"
4    // is 16961
5    ? MemShort(ptrSI, 16961,2)         // A pointer
6    ? MemShort(ptrSI, 16961,1)         // A pointer
7    // Same pointer as above
See Also