AsString – atoi()
Converts a character string into a DINT value
Call syntax (Automation Basic)
z = atoi(adr(Str))
Parameters
I/O | Parameter | Data type | Description |
---|---|---|---|
IN | pString | UDINT (given as a pointer to STRING) | Address of character string to be converted |
OUT | z | DINT | Numerical value of character string |
Code example (Init-Sp)
(* init program *)
strcpy(ADR(str), ADR(‘123’));
int_read_value := atoi(ADR(str)); (*get int_value from the string*)
Variable declaration
Name | Data type | Scope |
---|---|---|
int_read_value | UDINT | Local |
str | STRING[4] | Local |