MemSet Function | |
Fill a memory buffer with a specified character.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION MemSet(
ptrBuffer AS IntPtr,
bValue AS BYTE,
wCount AS DWORD
) AS IntPtr
public static IntPtr MemSet(
IntPtr ptrBuffer,
byte bValue,
uint wCount
)
Request Example
View SourceParameters
- ptrBuffer
- Type: IntPtr
A pointer to the memory buffer to fill. - bValue
- Type: Byte
The code for the character, as a number from 0 to 255. - wCount
- Type: DWord
The number of bytes to fill.
Return Value
Type:
IntPtr
A pointer to the filled memory buffer.
Remarks
MemSet() sets the first
wCount characters of the memory buffer pointed to by
ptrBuffer to a specified character.
Tip |
---|
This function allows the direct manipulation of a memory location and should be used with extreme care.
|
Examples
This example uses MemSet() to fill up all characters of an allocated buffer with "A":
1FUNCTION MemReplicate() AS VOID
2 LOCAL ptrC AS PTR
3 ptrC := MemAlloc(10)
4 ptrC := MemSet(ptrC, Asc("A"),10)
5 ? ptrC
6 MemFree(ptrC)
This example uses MemSet() to change all characters of a PSZ to "Z":
1FUNCTION PszQ()
2 LOCAL pszS := "ABC" AS PSZ
3
4 MemSet(pszS, 90,3)
5 ? pszS
See Also