atol — convert the string into integer type.

Description:

u8 atol(u8 *string);
Convert the string string into integer value.

List of parameters:

string

String or pointer to the string that contains the number in decimal or hexadecimal format

Return values:

Function returns integer. If the integer number wasn’t found in the string the function returns value of zero.

Example:

<item addr="524:248" name="Test for atol function" type="script">
V-ID/V-ADDR {
        	if(opt0()) {                               	
                    	u8 str_1[] = "123";
                    	u8 str_2[] = "0xCF";                    	
                    	// Example 1
                    	u8 res_1 = atol(&str_1);
                    	// Example 2
                    	u8 res_2 = atol(&str_2);
                    	// Example 3
                    	u8 res_3 = atol("37");
                    	// Example 4
                    	u16 res_4 = atol("0xFFFF");                    	
                    	// Result output to the interface
                    	u8 strForMess[70];
                        sprintf(strForMess, "%cres_1 = %d\10res_2 = %d\10res_3 = %d\10res_4 = %d\10"
                               , 1, res_1, res_2, res_3, res_4);
                    	setStatus(@exciterId():32, &strForMess);
 
        	}
}
</item>

The result of performing the example in the interface:
res_1: 123

res_2: 207

res_3: 37

res_4: 65535