4.5.71. besCONVERT2ZCHAR(x)

[<<<] [>>>]

Use this macro to convert a VARIABLE that is already STRING type to zero character terminated string. This is needed many times when a BASIC string has to be passed to operating system functions.

The macro argument x is converted to zero character terminated string and the result will be pointed by y. y has to be a (char *) C variable.

If there is not enough memory the macro returns from the function with the error code COMMAND_ERROR_MEMORY_LOW thus there is no need to check the value of the variable y if it is NULL.

The memory allocated to store the ZCHAR string should be released by the macro @xref{besFREE}.

Note that the macro does not check wheter the string already contains a zero character or not. It simply allocates a buffer that has length n+1 bytes to store the n bytes of the original BASIC string and an extra zero character.

[<<<] [>>>]