Click or drag to resize

MemCopyString Function

X#
Copy one memory buffer to another and fill any remaining spaces with blanks.

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

Parameters

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

Return Value

Type: 
Remarks
MemCopyString() 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.
If the number of bytes in the source memory buffer is less than dwCount, the rest of the destination memory buffer is filled with blanks.
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 MemCopyString():
X#
1LOCAL pszDest := "Hi there" AS PSZ
2LOCAL pszSrc := "***" AS PSZ
3MemCopyString(pszDest, pszSrc, 5)
4? pszDest                            // "***  ere"
See Also