Atoi; Atof; Atol; Band (&) - AMX NETLINX PROGRAMMING LANGUAGE Manual

Programming language
Table of Contents

Advertisement

Reserved Identifiers
Keywords & Run-Time Library Functions (Cont.)

ATOI

ATOF

ATOL

BAND (&)

BNOT (~)

BOR (|)

102
Converts a character representation of a number to an signed 32-bit integer.
The syntax:
SLONG ATOI (CHAR STRING[ ])
Parameters:
• STRING - string containing the character representation of the integer.
Result:
• A 32-bit signed integer representing the converted string.
• Any non-numeric characters in the string are ignored.
• ATOI returns the value representing the first complete set of characters that
represents an integer.
• Valid characters are "0" through "9" and "-" (minus sign), if it occurs before the
number. If no valid characters are found, zero is returned as a result.
Example:
Num = ATOI('100') // Num = 100
Note: While you can pass in larger values, ATOI will truncate any value outside
the range -2147483648 to 2147483647 to the value -2147483648 (if negative)
or 2147483647 (if positive).
This function converts a character representation of a number to a 64-bit float-
ing-point value. It recognizes a character representation of a signed integer or
floating-point number (with or without exponent).
FLOAT ATOF (CHAR STRING[ ])
Parameters:
• STRING: An input string containing the character representation of the
floating-point number.
The result is a 64-bit floating-point number representing the converted string.
Any non-numeric characters in the string are ignored. ATOF returns the value
representing the first complete set of characters that represents a floating-point
value. Valid characters are "0" through "9", ".", the sign designators ("+" and
"-"), and the exponent ("e" or "E"). If no valid characters are found, zero is
returned as a result.
Num = ATOF('The total = -1.25e-3')// Num = -0.00125
This function converts a character representation of a number to a signed 32-bit
integer.
SLONG ATOL (CHAR STRING[ ])
Parameters:
• STRING: A string containing the character representation of the integer.
The result is a 32-bit signed integer representing the converted string. Any non-
numeric characters in the string are ignored. ATOL returns the value represent-
ing the first complete set of characters that represents an integer. Valid charac-
ters are "0" through "9" and the sign designators "+" and "-". If no valid
characters are found, zero is returned as a result.
Num = ATOL('Value = -128000')
This operator performs a bitwise AND on two data items, which can be constants
or variables.
This operator performs a bitwise NOT on a constant or variable.
This operator performs a bitwise OR on two data items, which can be constants
or variables.
NetLinx Programming Language Reference Guide
// Num = -128000

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Netlinx studio 2

Table of Contents