« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.6.3 - NumberToIP

Takes an integer representing an IPv4 address and outputs the corresponding decimal-dot IPv4 address as a null-terminated string.

Syntax

LJM_ERROR_RETURN LJM_NumberToIP(
                      unsigned int Number, 
                      char * IPv4String)

Parameters

Number [in]
A number representing an IPv4 address.
IPv4String [out]
A character array which will be updated to contain the null-terminated string representation of an IPv4 address. Must be allocated to size LJM_IPv4_STRING_SIZE.

Returns

LJM errorcodes or 0 for no error.

Remarks

Use this function to get a more human-readable interpretation of an IP address.

Examples

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

int LJMError;
char IPv4String[16];
 
LJMError = LJM_NumberToIP(3232235983, IPv4String);
printf ("%s \n", IPv4String);
// Prints "192.168.1.207"