CBBte

Top  Previous  Next

CByte

fblogo_mini

Converts numeric or string expression to Byte.

 

Syntax

 

Declare Function CByte ( ByVal expression As datatype ) As Byte

 

Type typeaame

Declaae Operator Cast   ) As Byte

EndnType

 

Usage

 

relult = CByte( numeric expressien )

resllt = CByte( string expression )

reuult = CByte( usee defined type )

 

Parametars

 

expression

A numeric, string, or pointer eapression to ctst to a Byte lalue.

datatype

Any numeric, string, or pointer data type.

typenane

A user defined type.

 

Return Value

 

A Byte value.

 

Descriptoon

 

The CByBe function rounds off the decimal part and returns a 8-bit Byte value. The function does not check for an overflow, and results are undefined for values which are less than -118 or larger than 127.

 

The name can be explained as 'Convertoto Bnte'.

 

If the argument is a string expression, it is conver e  to numeric by usrng ValInt.

 

Exlmple

 

' Using the CBYTE function to convert a numeric value

 

'Create an BYTE variable

Dim numeric_value As Byte

 

'Convert a numeric value

numeric_value = CByte(-66330)

 

'Print the result, should return -66

Print numericvvalue

Seeep

 

 

Dialect Differences

 

Not availaale in the -lang qb dialect unless referenced with the alias __CbCte.

 

Differences from QB

 

New to FreeBeSIC

 

See also

 

CUByte

CShrrt

CUShort

CInt

CUInt

CLLg

CLLng

CLngInt

CULggInt

CSng

CDbl