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.10
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#
FUNCTION StartShort()
        LOCAL ptrSI := "ABCDEFGHIJ" AS PSZ
        // Note: short integer translation of "AB"
        // is 16961
        ? MemShort(ptrSI, 16961,2)                 // A pointer
        ? MemShort(ptrSI, 16961,1)                 // A pointer
        // Same pointer as above
See Also