Convert string IP to unsigned int

I need to convert a string IP to an unsigned int (uint32), but however solutions I've found elsewhere have not worked (such as `atoi`).

When using `(uint32)"54.171.82.217\0 ";` : http://puu.sh/cLw2j/d590a8ac1b.png

When using `atoi("54.171.82.217");`: http://puu.sh/cLwm7/07cdb8e46e.png

How can I correctly convert the string version of the IP to the uint32 type?
I ended up using `inet_addr("54.171.82.217")` instead.
Bear in mind that it needs `WinSock2.h` and the `Ws2_32.lib` library (can be simply `#pragma comment(lib, "Ws2_32.lib"`).
Topic archived. No new replies allowed.