0
Follow the source code...
#define _WIN32_WINNT 0x0501
#include <stdio.h>
#include <ws2tcpip.h>
#include <winsock.h>
#include <windows.h>
WSADATA data;
struct addrinfo tips, *information;
void exaple_one(void);
void exaple_two(void);
void main(void) {
printf("chamando o exemplo dois\n");
exaple_two();
printf("chamando o exemplo um = ERROR\n");
exaple_one();
}
void exaple_one(void) {
struct addrinfo tips, *information;
WORD wRequestedVersion = MAKEWORD(1, 1);
int iResult = WSAStartup(wRequestedVersion, &data);
char localaddr[255];
if(iResult == SOCKET_ERROR) {
printf("Error...!");
}
getaddrinfo("www.netflix.com", NULL, &tips, &information);
struct addrinfo *ponteiro;
ponteiro = information;
getnameinfo(ponteiro->ai_addr, ponteiro->ai_addrlen, localaddr, sizeof(localaddr), NULL, 0, NI_NUMERICHOST);
printf("exaple one address = %s\n", localaddr);
}
void exaple_two(void) {
WORD wRequestedVersion = MAKEWORD(1, 1);
int iResult = WSAStartup(wRequestedVersion, &data);
char localaddr[255];
if(iResult == SOCKET_ERROR) {
printf("Error...!");
}
getaddrinfo("www.netflix.com", NULL, &tips, &information);
struct addrinfo *ponteiro;
ponteiro = information;
getnameinfo(ponteiro->ai_addr, ponteiro->ai_addrlen, localaddr, sizeof(localaddr), NULL, 0, NI_NUMERICHOST);
printf("example two address = %s\n", localaddr);
}
if you compile and run the above program you will see that the example one function for running the program someone could explain to me why this occurs ?
What’s the problem? Program runtime error? Or compilation yet?
– Jefferson Quesado