Jump to content

Futurebasic/Language/Reference/mkistr

From Wikibooks, open books for an open world

MKI$ function

[edit | edit source]

Syntax

[edit | edit source]

string$ = MKI$(intExpr)

Description

[edit | edit source]

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 current setting of DEFSTR BYTE/WORD/LONG.

See Also

[edit | edit source]

CVI; DEFSTR BYTE/WORD/LONG; CHR$; STR$; VAL