FutureBasic Logo

<<    Index    >> FutureBasic 5

mki$ function   function



Syntax:
PascalString = mki$(intExpr)

Description:
mki$ ("MaKe Integer string") returns a string which has the same internal bit pattern as intExpr; each character in the returned string will represent 8 bits from intExpr. The returned string will have a length of 1, 2 or 4 characters, depending on which of defstr byte, defstr word or defstr long is currently in effect. If defstr byte is in effect, you should make sure that intExpr is within the range of numbers that can be expressed in a single byte; similarly, if defstr word is in effect, you should make sure that intExpr is within the range of numbers that can be expressed in a "word"-length (2-byte) integer.
mki$ is useful for translating the 4-letter file types, creator codes, resource types, etc. that are frequently used in MacOS Toolbox routines. These codes are typically transmitted in the form of long-integer values; by using the mki$ function you can translate these long integers into strings for display purposes (be sure to set defstr long before doing this).
If defstr byte is in effect, mki$ returns the same thing as the chr$ function.

Note:
When defstr long is in effect and 4-character strings and long-integers are being converted, mki$ is essentially the inverse of the cvi function. Note, however, that the behavior of cvi does not depend on the the current setting of defstr byte/word/long.

See Also:
cvi; defstr byte/word/long; chr$; str$; val