MKShort

FreeBASIC

MKShort
 
Does a binary copy from a Short variable to a String, setting its length to 2 bytes

Syntax

Declare Function MKShort ( ByVal number As Short ) As String

Usage

result = MKShort[$](number)

Parameters

number
A Short variable to binary copy to a String.

Return Value

Returns a String with a binary copy of the Short.

Description

Does a binary copy from a SHORT variable to a string, setting its length to 2 bytes. The resulting string can be read back to a Short by CVShort

This function is useful to write numeric values to buffers without using a Type definition.

Example

Dim a As Short, b As String
a = 4534
b = MKShort(a)
Print a, CVShort(b)
Sleep



Dialect Differences

  • Not available in the -lang qb dialect unless referenced with the alias __Mkshort.

Differences from QB

  • In QBasic this function is called MKI.

See also