CByte

Converts numeric or string expression to KeyPgByteByte.

Syntax
	KeyPgDeclareDeclare KeyPgFunctionFunction CByte ( KeyPgByvalByVal expression KeyPgAsAs DataTypedatatype ) KeyPgAsAs KeyPgByteByte

	KeyPgTypeType typename
		KeyPgDeclareDeclare KeyPgOperatorOperator KeyPgCastCast ( ) KeyPgAsAs KeyPgByteByte
	End Type

Usage
	result = CByte( numeric expression )
	result = CByte( string expression )
	result = CByte( user defined type )

Parameters
	expression
		A numeric, string, or pointer expression to cast to a KeyPgByteByte value.
	datatype
		Any numeric, string, or pointer data type.
	typename
		A user defined type.

Return Value
	A KeyPgByteByte value.

Description
	The CByte function rounds off the decimal part and returns a 8-bit KeyPgByteByte 
	value. The function does not check for an overflow, and results are 
	undefined for values which are less than -128 or larger than 127.

	The name can be explained as 'Convert to Byte'.

	If the argument is a string expression, it is converted to numeric by 
	using KeyPgValintValInt.

Example
	' 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(-66.30)

	'Print the result, should return -66
	Print numeric_value
	Sleep

Dialect Differences
	* Not available in the CompilerOptlang-lang qb dialect unless referenced with the 
	  alias __Cbyte.

Differences from QB
	* New to FreeBASIC

See also
	* KeyPgCubyteCUByte
	* KeyPgCshortCShort
	* KeyPgCushortCUShort
	* KeyPgCintCInt
	* KeyPgCuintCUInt
	* KeyPgClngCLng
	* KeyPgCulngCULng
	* KeyPgClngintCLngInt
	* KeyPgCulngintCULngInt
	* KeyPgCsngCSng
	* KeyPgCdblCDbl

