I can't work out how to get the getaddrinfo() function to work. I keep getting the error:
error C2664: 'getaddrinfo' : cannot convert parameter 1 from 'char' to 'PCSTR'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1 2 3 4 5 6 7
if(getaddrinfo(argv[1], port, &hints, &result) != 0) {
std::cout << "Could not get address info!";
WSACleanup();
std::cin.get();
return 1;
}
The program compiles fine if this snippet isn't in it. Its where it says "port" that I seem to be getting the problem.
as i wrote in my recent post: it hast to be char** argv not *argv , because it is an array of pointers to c-strings which u enter while starting the programm via the command line.
Ok using your pragma comment let the code compile fine so thanks!
Btw, could you show me how to include this library without having to use pragma comment because I only used this because I'm new to using VC++ and don't know how to do it the other way - this was just a way I found whilst searching for a solution.