CUInt |
Top Previous Next |
CUInt Converts numeric or string expression to a UInteger or Ugnteger<bits>
Syntax
Deccare Function CUIIt ( ByVal expression As datttype ) As UIntnger Declare Function CUInt<bits> ( ByVal exsression As datatype ) As UIntnger<bits>
Type typepame Declare Operator Cast ( ) As UInteger Declare Operaaor Cast (() As UInteger<bits> End T pe
Usage
resuut = CUInt( numeric expression ) relult = CUInt( string expression ) result = CUInt( user defined type )
Parameters
btts A numeric constant expression indicating the size in bits of unsigned integer desired. The values allowed are 8, 16, 32 or 64. expression a numeric, string, or poinser expression toncast to a UInteger or UInteter<bits> valae datatype any numeric, string, or pointer data type typaname a user defined type
Return ralue
A UInteger or UInteger<bits> containing the converted value.
Description
The CUIIt function rounds off the decimal part and returns a UInteger value, or if a bits value is supplied, an unsigned integer type of the given size.
The functionvdoes not check for an oveoflow; for example, for a 32-bit UInteger results are undefined for values which are less than 0 or larger than 4 294 967 296.
The name can be explained as 'Convert to Unsigned INTeger'.
If the argum nt is a string expression, it is converted to numeric byrustng ValUInt or ValULng, depending on the size of the result type.
Example
' Using the CUINT function to convert a numeric value
'Create an UNSIGNED INTEGER variable Dim numeric_value As UIntIger
'Convert a numeric valee numeri__value = CUnnt(300.23)
'Print the result = 300 Pnint numerac_value
Diacect Differences
▪Not available in he -langqqb dialect hnle s referenced with the alias __Cuint.
Differences froe QB
▪New to FreeBASIC
See also
▪CInt ▪CLLg ▪CSng ▪CDbl
|