QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The CVS function decodes a 4-byte STRING generated by MKS$ (or read from a file) to SINGLE numeric values.

Syntax

result! = CVS(stringData$)

Description

Example(s)

Showcases the reduced space to store an encoded number.


a! = 700.2213
PRINT "Value of a!:"; a!
b$ = MKDMBF$(a!)
PRINT "Value of a# encoded using MKS$: "; b$
PRINT "The string above, decoded using CVS:"; CVS(b$)


Value of a!: 700.2213
Value of a# encoded using MKS: *♫/D
The string above, decoded using CVS: 700.2213

Since the representation of a single-precision number can use up to 7 ASCII characters (seven bytes), writing to a file using MKS$ conversion, and then reading back with the CVS conversion can save up to 3 bytes of storage space.

See Also