#### MKDCVD.md11 KB Permalink History Raw

MKD\$ function

Purpose: MKD\$ converts a double precision number to an 8-byte fixed length string.

Note well that the returned string is stored in binary form which can include embedded zeros. Most BCX string functions and operators can not handle these strings because zero, normally, is used as a terminator to indicate the end of the string.

 Syntax: `````` Retstr\$ = MKD\$(DoubleNum#) ``````  Parameters: Retstr\$ Returned 8-byte fixed length string. DoubleNum# Double precision number to be converted to an 8-byte fixed length string.

A MKD\$ `FUNCTION` call should not be used as the return value to a string function.

``````
'WRONG:
FUNCTION foo\$()
LOCAL D AS DOUBLE
D# = 555555.5555
FUNCTION = MKD\$(D#)
END FUNCTION

'CORRECT:
FUNCTION foo() AS LPSTR
LOCAL R\$
LOCAL D AS DOUBLE
D# = 555555.5555
R\$ = MKD\$(D#)
FUNCTION = R
END FUNCTION
``````

Also note that only single assignments should be performed.

``````
A\$ = MKD\$(dbl#)            ' Valid
``````
``````
A\$ = MKD\$(dbl#) + "string" ' Not Valid
``````

These limitations are due to the fact that these functions contain binary data. Care should also be taken not to try an reassign a string:

``````
B\$ = A\$
``````

would not give the desired result since it would use strcpy.

MKLD\$ function

Purpose: MKLD\$ converts a long double precision number to an 10-byte fixed length string.

Note well that the returned string is stored in binary form which can include embedded zeros. Most BCX string functions and operators can not handle these strings because zero, normally, is used as a terminator to indicate the end of the string.

 Syntax: `````` Retstr\$ = MKLD\$(LongDoubleNum) ``````  Parameters: Retstr\$ Returned 10-byte fixed length string. LongDoubleNum Double precision number to be converted to an 10-byte fixed length string.

A MKLD\$ `FUNCTION` call should not be used as the return value to a string function.

``````
'WRONG:
FUNCTION foo\$()
LOCAL D AS LONG DOUBLE
D = 555555.5555
FUNCTION = MKLD\$(D#)
END FUNCTION

'CORRECT:
FUNCTION foo() AS LPSTR
LOCAL R\$
LOCAL D AS LONG DOUBLE
D = 555555.5555
R\$ = MKLD\$(D#)
FUNCTION = R
END FUNCTION
``````

Also note that only single assignments should be performed.

``````
A\$ = MKLD\$(LongDoubleNum)            ' Valid
``````
``````
A\$ = MKLD\$(LongDoubleNum) + "string" ' Not Valid
``````

These limitations are due to the fact that these functions contain binary data. Care should also be taken not to try an reassign a string:

``````
B\$ = A\$
``````

would not give the desired result since it would use strcpy.

MKI\$ function

Purpose: MKI\$ converts a 16-bit(2-byte) SHORT to a 2-byte fixed length string.

Note well that the returned string is stored in binary form which can include embedded zeros. Most BCX string functions and operators can not handle these strings because zero, normally, is used as a terminator to indicate the end of the string.

 Syntax: `````` Retstr\$ = MKI\$(ShortNum) ``````  Parameters: Retstr\$ Returned 2-byte fixed length string. ShortNum SHORT number to be converted to an 2-byte fixed length string.

A MKI\$ `FUNCTION` call should not be used as the return value to a string function.

``````
'WRONG:
FUNCTION foo\$()
LOCAL D AS SHORT
D = 5555
FUNCTION = MKI\$(D)
END FUNCTION

'CORRECT:
FUNCTION foo() AS LPSTR
LOCAL R\$
LOCAL D AS SHORT
D = 5555
R\$ = MKI\$(D)
FUNCTION = R
END FUNCTION
``````

Also note that only single assignments should be performed.

``````
A\$ = MKI\$(ShortNum)            ' Valid
``````
``````
A\$ = MKI\$(ShortNum) + "string" ' Not Valid
``````

These limitations are due to the fact that these functions contain binary data. Care should also be taken not to try an reassign a string:

``````
B\$ = A\$
``````

would not give the desired result since it would use strcpy.

MKL\$ function

Purpose: MKL\$ converts an integer to an 4-byte fixed length string.

Note well that the returned string is stored in binary form which can include embedded zeros. Most BCX string functions and operators can not handle these strings because zero, normally, is used as a terminator to indicate the end of the string.

 Syntax: `````` Retstr\$ = MKL\$(IntNum%) ``````  Parameters: Retstr\$ Returned 4-byte fixed length string. IntNum% integer number to be converted to an 4-byte fixed length string.

A MKL\$ `FUNCTION` call should not be used as the return value to a string function.

``````
'WRONG:
FUNCTION foo\$()
LOCAL D%
D% = 555555
FUNCTION = MKL\$(D%)
END FUNCTION

'CORRECT:
FUNCTION foo() AS LPSTR
LOCAL R\$
LOCAL D%
D% = 555555
R\$ = MKL\$(D%)
FUNCTION = R
END FUNCTION
``````

Also note that only single assignments should be performed.

``````
A\$ = MKL\$(LongNum)            ' Valid
``````
``````
A\$ = MKL\$(LongNum) + "string" ' Not Valid
``````

These limitations are due to the fact that these functions contain binary data. Care should also be taken not to try an reassign a string:

``````
B\$ = A\$
``````

would not give the desired result since it would use strcpy.

MKS\$ function

Purpose: MKS\$ converts a single precision number to an 4-byte fixed length string.

Note well that the returned string is stored in binary form which can include embedded zeros. Most BCX string functions and operators can not handle these strings because zero, normally, is used as a terminator to indicate the end of the string.

 Syntax: `````` Retstr\$ = MKS\$(Single!) ``````  Parameters: Retstr\$ Returned 4-byte fixed length string. Single! Single precision number to be converted to a 4-byte fixed length string.

A MKS\$ `FUNCTION` call should not be used as the return value to a string function.

``````
'WRONG:
FUNCTION foo\$()
LOCAL D AS SINGLE
D! = 55.5555
FUNCTION = MKS\$(D!)
END FUNCTION

'CORRECT:
FUNCTION foo() AS LPSTR
LOCAL R\$
LOCAL D AS SINGLE
D! = 55.5555
R\$ = MKS\$(D!)
FUNCTION = R
END FUNCTION
``````

Also note that only single assignments should be performed.

``````
A\$ = MKS\$(FloatNum!)            ' Valid
``````
``````
A\$ = MKS\$(FloatNum!) + "string" ' Not Valid
``````

These limitations are due to the fact that these functions contain binary data. Care should also be taken not to try an reassign a string:

``````
B\$ = A\$
``````

would not give the desired result since it would use strcpy.

CVD function

Purpose: CVD converts a MKD\$ format 8-byte fixed length string to a double precision number.

 Syntax: `````` Retval# = CVD(MKDString\$) ``````  Parameters: Retval# Returned Double precision number. MKDString\$ MKD\$ format 8-byte fixed length string to be converted to a double precision number.

CVLD function

Purpose: CVLD converts a MKD\$ format 10-byte fixed length string to a long double precision number.

 Syntax: `````` Retval# = CVLD(MKLDString\$) ``````  Parameters: Retval# Returned Double precision number. MKDString\$ MKLD\$ format 10-byte fixed length string to be converted to a long double precision number.

CVI function

Purpose: CVI converts an MKI\$ format 2-byte fixed length string to a 16-bit(2-byte) SHORT number.

 Syntax: `````` Retval% = CVI(MKIString\$) ``````  Parameters: Retval% Returned integer number. MKIString\$ MKI\$ format 2-byte fixed length string to be converted to 16-bit(2-byte) SHORT number.

CVL function

Purpose: CVL converts an MKL\$ format 4-byte fixed length string to a long integer number.

 Syntax: `````` Retval% = CVL(MKLString\$) ``````  Parameters: Retval% Returned long integer number. MKLString\$ MKL\$ format 4-byte fixed length string to be converted to a long integer number.

CVS function

Purpose: CVS converts an MKS\$ format 4-byte fixed length string to a single precision number.

 Syntax: `````` Retval! = CVS(MKSString\$) ``````  Parameters: Retval! Returned single precision number. MKSString\$ MKS\$ format 4-byte fixed length string to be converted to a single precision number.