how to convert IP address in char[] to Uint32_t in c?

后端 未结 2 1216
太阳男子
太阳男子 2021-01-18 02:43

I write a program which takes IP address as an argument and i wanted to store this IP address in the unit32_t. I can easily convert uint32_t to back to character array. How

2条回答
  •  醉酒成梦
    2021-01-18 03:16

    You use the inet_pton. function

    And for the other way around you should have used inet_ntop.


    For Windows-specific documentation, see inet_pton and inet_ntop.


    Note that the functions can be used for both IPv4 and IPv6.

提交回复
热议问题