How to get my IP address in Win32 [modified]
-
what I need is know the rightmost part of the IP address for example if it's 192.133.14.17 I want to get the 17.
modified on Thursday, April 24, 2008 11:26 AM
The "17" is on the right side of the address, not the left part, that's probably why you cannot get it.
Maximilien Lincourt Your Head A Splode - Strong Bad
-
The "17" is on the right side of the address, not the left part, that's probably why you cannot get it.
Maximilien Lincourt Your Head A Splode - Strong Bad
-
what I need is know the rightmost part of the IP address for example if it's 192.133.14.17 I want to get the 17.
modified on Thursday, April 24, 2008 11:26 AM
And what is your difficulty about?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
And what is your difficulty about?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
Have you the IP? Is it storead as a string or whatever? i.e. be specific. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
Have you the IP? Is it storead as a string or whatever? i.e. be specific. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
what I need is know the rightmost part of the IP address for example if it's 192.133.14.17 I want to get the 17.
modified on Thursday, April 24, 2008 11:26 AM
One way would be:
gethostname();
struct hostent *host = gethostbyname();
struct in_addr *ptr = (struct in_addr *) host->h_addr_list[0]
int octet = ptr->S_un.S_un_b.s_b4;"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
One way would be:
gethostname();
struct hostent *host = gethostbyname();
struct in_addr *ptr = (struct in_addr *) host->h_addr_list[0]
int octet = ptr->S_un.S_un_b.s_b4;"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne