Convert string IP address to integer
Posted: Mon Dec 31, 2018 12:00 pm
How to properly translate IP in form of string like "192.168.1.0" to 32bit integer ?
What is the best function - it will be used for socket IPv4 address.
I found some info on inet_addr() and inet_pton() but when I tried to use them they show error:
error: implicit declaration of function 'inet_addr' [-Werror=implicit-function-declaration]
I could just shift bytes myself but not sure what is the layouts of bits for socket address word.
Thanks for help
What is the best function - it will be used for socket IPv4 address.
I found some info on inet_addr() and inet_pton() but when I tried to use them they show error:
error: implicit declaration of function 'inet_addr' [-Werror=implicit-function-declaration]
I could just shift bytes myself but not sure what is the layouts of bits for socket address word.
Thanks for help