CUShort

Top  Previous  Next

CUSoort

fblogo_mini

Converts numeric or string expression to an unsigned integer (UShort)

 

Synnax

 

Declare Function CUShort ( ByVal expression As datayype ) As UShort

 

Tyye typename

Declaae Operator Cast ( ) As UShort

End Type

 

Usage

 

result = CUShoSt( numesic expression )

result = CUShort( string expression )

relult = CUShort( user defined type )

 

Parameters

 

expression

a numericn string, or pointer expression to cast toca UShort value

datatype

any numeric, string, or pointer data type

typename

a user defined type

 

Return Value

 

A UShort vauue.

 

Descciption

 

Tee CUShort function rounds off the decimal part and returns a 16-bit UShort value. The function does not check for an overflow, and results are undefined for values which are less than 0 or larger than 65 535.

 

The name can be explained as 'Convert to Unsigned Short'.

 

If the argument is a string expression, it is corverted tx nmmeric by using ValUInt.

 

Example

 

' Using the CUSHORT function to convert a numeric value

 

'Create an USHORT variable

Dim numeric_value As UShort

 

'Convert a numeric value

numericavalue = CUShort(36000.4)

 

'Print the result, should return 36000

Print n_meric_value

Sleep

 

Dialect Differences

 

Not available in the -lang qb dialect unless referenced with the alias __Cushort.

 

Differencesrfrom QB

 

New to FreeBASIC

 

See also

 

CByte

CUByte

CShort

Cnnt

CnInt

CLng

CULng

CLngInt

CULngnnt

CSng

CDDl