Click or drag to resize

Psz2Usual Function

X#
Convert a null-terminated string to a strongly typed string.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION Psz2Usual(
	pszString AS PSZ
) AS USUAL
Request Example View Source

Parameters

pszString
Type: Psz
A null-terminated string.

Return Value

Type: Usual
Remarks
Psz2String() can be used to do any necessary conversions before calling functions that expect a strongly typed string in their argument list.
Remarks
Tip Tip
The PSZ type is included in the X# language and runtime for compatibility only. In most cases the type can and should be replaced with normal strings.
If you need to interface with Win32 API functions that expect an ansi string, there is often also an alternative with a unicode string. We recommend to use that alternative when possible.
Examples
This example uses Psz2String() to convert a null-terminated string to a strongly typed string:
X#
1LOCAL cMyBuffer AS STRING
2LOCAL pszString AS PSZ
3pszString := String2Psz("zero terminated")
4cMyBuffer := Psz2String(pszString)
See Also