Click or drag to resize

MemCopy Function

X#
Copy one memory buffer to another.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION MemCopy(
	ptrDest AS IntPtr,
	ptrSource AS IntPtr,
	dwCount AS DWORD
) AS IntPtr
Request Example View Source

Parameters

ptrDest
Type: IntPtr
A pointer to the destination memory buffer.
ptrSource
Type: IntPtr
A pointer to the source string to copy.
dwCount
Type: DWord
The number of bytes to copy.

Return Value

Type: IntPtr
A pointer to the destination memory buffer.
Remarks
MemCopy() copies the specified number of bytes from the source memory buffer to the destination memory buffer.
If portions of memory occupied by the source string overlap with portions in the destination, the overlapping region is overwritten.
Use MemMove() to copy overlapping regions before they are overwritten.
Tip Tip
This function allows the direct manipulation of a memory location and should be used with extreme care.
Examples
This example uses MemCopy():
X#
1LOCAL pszDest := "Hi there" AS PSZ
2LOCAL pszSrc := "***" AS PSZ
3MemCopy(pszDest, pszSrc, 3)
4? pszDest                            // ***there
See Also