Skip to content

Cvshort

Paul Squires edited this page Oct 19, 2026 · 2 revisions

Home › String Functions › CVShort

CVShort

Reads a Short back from a 2-byte string.

Syntax

Declare Function CVShort ( ByRef str As Const String ) As Short

Parameters

  • str

Description

Returns a 16-bit Short integer value using the binary data contained in a String of at least two bytes in length. A value of zero (0) is returned if the string is less than two bytes in length.

CVShort is used to convert 2-byte strings created with MKShort.

This function can also be used to convert 16-bit integer values from a memory or file buffer without the need for a Type structure. However, just as with the type structure, special care should be taken when using CVShort to convert strings that have been read from a buffer.

Return Value

Short variable holding the binary copy of a Keypgshort.

Remarks

Usage

result = CVShort( str )

Dialect Differences

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

Differences from QB

  • In QB this function is called CVI

See also

Examples

Dim si As Short, s As String

s = "AB"

si = CVShort(s)

Print Using "s = ""&"""; s

Print Using "si = _&H&"; Hex(si)

Category: String Functions
Kind: function


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally