Hi, so I'm getting a pop up error message with a title of "Entry Point Not Found" and a message of "The procedure entry point InetNtopW could not be located in the dynamic link library WS2_32.dll". This happens when I run this program, the second I launch it the message pops up, it doesn't even print the first line. Without the inet_ntop function call it will compile/work correctly though. I also tried replacing inet_ntop with a call to inetNtop, and it just does the exact same error pop up. I'm using Unicode character set of that's important (which is default as far as I know).
I took a screenshot for you: http://img79.imageshack.us/my.php?im...goingonzc2.jpg
Here is the code:
Cheers.Code:#include <iostream> #include <winsock2.h> #include <ws2tcpip.h> #include <cstring> using std::cout; using std::cin; using std::endl; WSADATA wsaData; int main(int argc, char * argv[]) { int wsaReturnVal = WSAStartup(MAKEWORD(1, 1), &wsaData); if (wsaReturnVal) { cout << "Error number: " << wsaReturnVal << endl; exit(1); } char * fpoint = strrchr(argv[0], '\\'); if (argc != 2) { printf("Usage: <%s> <hostname>", fpoint+1); exit(1); } struct addrinfo hints, *res, *p = NULL; memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_PASSIVE; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; int status = getaddrinfo(argv[1], NULL, &hints, &res); if (status == -1) { cout << "getaddrinfo error." << endl; exit(1); } printf("IP address for %s: ", argv[1]); for (p = res; p != 0; p = p->ai_next) { void * addr; char * ipVer; if (p->ai_family == AF_INET) { struct sockaddr_in * IPv4 = (struct sockaddr_in *)p->ai_addr; addr = &(IPv4->sin_addr); ipVer = "IPv4"; } else { struct sockaddr_in6 * IPv6 = (struct sockaddr_in6 *)p->ai_addr; addr = &(IPv6->sin6_addr); ipVer = "IPv6"; } char ipBuff[46]; inet_ntop(hints.ai_family, addr, ipBuff, sizeof(ipBuff)); printf("%s: %s", ipVer, ipBuff); } freeaddrinfo(res); if (WSACleanup()) { cout << "Cleanup Error." << endl; exit(1); } }



LinkBack URL
About LinkBacks


