Difference between revisions of "CVL"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
imported>Clippy
Line 8: Line 8:
* Numeric values read in from a random-access disk file must be converted from [[ASCII]] string characters back into numbers if they are to be arithmetically manipulated.
* Numeric values read in from a random-access disk file must be converted from [[ASCII]] string characters back into numbers if they are to be arithmetically manipulated.


* [[CVI]] converts a 2-byte string to an [[INTEGER]] number. [[MKI$]] is its complement.
* CVI converts a 2-byte string created by [[MKI$]] to an [[INTEGER]] number.


* [[CVS]] converts a 4-byte string to a [[SINGLE]]-precision number. [[MKS$]] is its complement.
* [[CVS]] converts a 4-byte string created by [[MKS$]] to a [[SINGLE]]-precision number.


* CVL converts a 4 byte string to a [[LONG]] integer number. [[MKL$]] is its compliment.
* [[CVL]] converts a 4 byte string created by [[MKL$]] to a [[LONG]] integer number.  


* [[CVD]] converts an 8-byte string to a [[DOUBLE]]-precision number. [[MKD$]] is its complement.
* [[CVD]] converts an 8-byte string created by [[MKD$]] to a [[DOUBLE]]-precision number.


* CV functions cannot be used to convert any values except from MK function values!
* CV functions cannot be used to convert any values except from MK function values!

Revision as of 08:22, 13 September 2009

Purpose: To convert string values to numeric values.

Syntax: CVL(4-byte string)

Comments:

  • Numeric values read in from a random-access disk file must be converted from ASCII string characters back into numbers if they are to be arithmetically manipulated.
  • CVI converts a 2-byte string created by MKI$ to an INTEGER number.
  • CVS converts a 4-byte string created by MKS$ to a SINGLE-precision number.
  • CVL converts a 4 byte string created by MKL$ to a LONG integer number.
  • CVD converts an 8-byte string created by MKD$ to a DOUBLE-precision number.
  • CV functions cannot be used to convert any values except from MK function values!


Examples:

FIELD #1, 4 AS N$, 12 AS B$...
GET #1
Y& = CVL(N$)

Explanation:

Reads a field from file #1, and converts the first four bytes (N$) into a long integer number assigned to the variable Y&.
Since a long number can contain as many as ten ASCII characters (ten bytes), writing a file using MKL$ conversion, and reading with the CVL conversion, as many as six bytes per number recorded are saved on the storage medium.


See also: MKI$, MKS$, MKL$, MKD$, Bitmaps



Navigation:

Go to Keyword Reference - Alphabetical

Go to Keyword Reference - By usage