Click or drag to resize

MemCopyString Function

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.10
Syntax
 FUNCTION MemCopyString(
	ptrDest AS IntPtr,
	cSource AS STRING,
	dwCount AS DWORD
) AS VOID
View Source

Parameters

ptrDest
Type: IntPtr
A pointer to the destination memory buffer.
cSource
Type: String
The source string to copy.
dwCount
Type: UInt32
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#
LOCAL pszDest := "Hi there" AS PSZ
LOCAL pszSrc := "***" AS PSZ
MemCopyString(pszDest, pszSrc, 5)
? pszDest                                                        // "***  ere"
See Also