« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.6.5 - IPToNumber

Takes a decimal-dot IPv4 string representing an IPv4 address and outputs the corresponding integer version of the address.

Syntax

LJM_ERROR_RETURN LJM_IPToNumber(
                      const char * IPv4String,
                      unsigned int * Number)

Parameters

IPv4String [in]
A decimal dot string representing an IPv4 address.
Number [out]
The numerical representation of IPv4String.

Returns

LJM errorcodes or 0 for no error. Returns LJME_INVALID_PARAMETER if IPv4String could not be parsed as an IPv4 address.

Remarks

Use this function to convert a human-readable interpretation of an IP address into an integer value.

Examples

[C/C++] Convert an IPv4 string into a number.

int LJMError;
unsigned int Number;
 
LJMError = LJM_IPToNumber("192.168.1.207", &Number);
printf ("%u \n", Number);
// prints 3232235983