MemChr Function |
Namespace: XSharp.RT
FUNCTION MemChr( ptrBuffer AS IntPtr, dwChar AS BYTE, dwCount AS DWORD ) AS IntPtr
public static IntPtr MemChr( IntPtr ptrBuffer, byte dwChar, uint dwCount )
1FUNCTION FindChar() AS VOID 2 LOCAL pszC1 := "ABCDEF" AS PSZ 3 ? MemChr(pszC1, ASC("A"), 6) // A pointer 4 ? MemChr(pszC1, ASC("B"), 6) // A pointer 5 ? MemChr(pszC1, ASC("B"), 1) 6 // NULL_PTR: ASC("B") is not in the 7 // first "1" characters of the PSZ
1FUNCTION FindChar2() AS VOID 2 LOCAL ptrBuff := MemAlloc(10) AS PTR 3 IF ptrBuff != NULL_PTR 4 // Write 68 to first 10 5 MemSet(ptrBuff, 68, 10) 6 // Overwrite first 5 with 67 7 MemSet(ptrBuff, 67, 5) 8 ? MemChr(ptrBuff, 68, 10) //3CEF:07DD 9 ? MemChr(ptrBuff, 67, 10) //3CEF:07D8 10 ENDIF