ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Dev-C++ IP address query problem ... (Sdk)
Dev-C++ IP address query problem ... // Sdklady nighthawkMay 3, 2006, 11:58am
What is wrong with this code? It's not working and the suggested fix isn't
either ... perhaps I have it in the wrong place within my code? AW's site doesn't do a good job of explaining where to put stuff :o. I want to query IP addresses for incoming visitors ... So far I've been told to change what's on the website from this ... sprintf (msg, "Your IP address is %s"); inet_ntoa (*(struct in_addr*)&address); to this ... sprintf (msg, "Your IP address is %s", inet_ntoa (*(struct in_addr*)&address)); That didn't work :o. The full code from the website is below, I have it at the very end of my code ... this works but doesn't give any IP address, seems to be a problem with the inet_ntoa (*(struct in_addr*)&address); portion, if I remove that line I get no errors but I also get no IP address :o. { int rc; int address; char msg[256]; /* provide IP addresses in response to spoken requests */ if (!strcmp (aw_string (AW_CHAT_MESSAGE), "What is my address?")) if (rc = aw_address (aw_int (AW_CHAT_SESSION))) aw_say ("Sorry, I cannot determine your IP address"); else { address = aw_int (AW_AVATAR_ADDRESS); /* using the suggested fix from above */ sprintf (msg, "Your IP address is %s", inet_ntoa (*(struct in_addr*)&address)); aw_say (msg); } } In my code after the above is one final ... without any of the above I get no errors in compiling } |