MemByte Function |
Namespace: XSharp.RT
FUNCTION MemByte( ptrBuffer AS IntPtr, bChar AS BYTE, dwCount AS DWORD ) AS IntPtr
public static IntPtr MemByte( IntPtr ptrBuffer, byte bChar, uint dwCount )
1FUNCTION FindChar() 2 LOCAL pszC1 := "ABCDEF" AS PSZ 3 ? MemByte(pszC1, ASC("A"), 6) // 3F37:2788 4 ? MemByte(pszC1, ASC("B"), 6) // 3F37:2789 5 ? MemByte(pszC1, ASC("B"), 1) // 0000:0000 6 // NULL_PTR: ASC("B") is not in the 7 // first "1" characters of the PSZ
1FUNCTION FindChar2() 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 ? MemByte(ptrBuff, 68, 10) // 3CA7:07DD 9 ? MemByte(ptrBuff, 67, 10) // 3CA7:07D8 10 ENDIF 11 MemFree(ptrBuff)