Mem2String Function |
Namespace: XSharp.RT
FUNCTION Mem2String( ptrSource AS IntPtr, dwCount AS DWORD ) AS STRING
public static string Mem2String( IntPtr ptrSource, uint dwCount )
Tip |
---|
Contrary to normal PSZs, strings are not static and may be collected by the garbage collector. Therefore, if you supply a string as an argument to a function, like Mem2String, which directly or indirectly allocates dynamic memory, you may run into trouble. For example, in Mem2String(Time(), 5), Time() may cause problems. But Mem2String("hi there", 5) will not cause problems since literal strings are not collected. |
1LOCAL pszSource AS PSZ 2pszSource := "ABCDEF" 3? Mem2String(pszSource, 3) // ABC