Skip to main content

to_int

Discworld driver help

to_int

Name

to_int - convert a float, buffer or string to an int

Synopsis

int to_int( float x );
int to_int( buffer x );
int to_int( string x );

Description

If 'x' is a float, the to_int() call returns the number of type 'int' that is equivalent to 'x' (with any decimal stripped off). If 'x' is a buffer, the call returns the integer (in network-byte-order) that is embedded in the buffer. If 'x' is a string, then the string is converted to an integer. An undefined value is returned if the string is not a valid number.

See also

to_float(), read_buffer(), sprintf(), sscanf()