Skip to content
Paul Squires edited this page Oct 19, 2026 · 2 revisions

Home › Converting Data Types › CULng

CULng

Converts a number or string to a 32-bit ULong, rounding to the nearest; no overflow check.

Syntax

Declare Function CULng ( ByVal expression As datatype ) As ULong
Type typename
Declare Operator Cast ( ) As ULong
End Type

Parameters

  • expression
  • datatype
  • typename

Description

The CULng function rounds off the decimal part and returns a 32 bit ULong value. The function does not check for an overflow. The name can be explained as 'Convert to Unsigned LoNG'.

If the argument is a string expression, it is converted to numeric by using ValUInt or ValULng.

Return Value

A ULong value.

Remarks

Usage

result = CULng( numeric expression )

result = CULng( string expression )

result = CULng( user defined type )

Dialect Differences

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

Differences from QB

  • New to FreeBASIC

See also

Examples

' Using the CULNG function to convert a numeric value

'Create an UNSIGNED LONG variable

Dim numeric_value As ULong

'Convert a numeric value

numeric_value = CULng(300.23)

'Print the result = 300

Print numeric_value

Sleep

Category: Converting Data Types
Kind: function


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally