slt, je cherchere a fconvertir une @ ip vers un Hostname en visual c++
et j'aimerai savoir si il y aurai des exemple avecgethostbyaddr(
slt, je cherchere a fconvertir une @ ip vers un Hostname en visual c++
et j'aimerai savoir si il y aurai des exemple avecgethostbyaddr(
Et voila:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #include <stdafx.h> #include <windows.h> #include <winsock.h> #include <stdio.h> int main ( int argc, char *argv[] ) { struct hostent *sn; struct in_addr in; WSADATA wsaData; WORD wVersionRequested; if ( argc != 2 ) exit(1); wVersionRequested = MAKEWORD( 2, 2 ); WSAStartup( wVersionRequested, &wsaData ); in.s_addr = inet_addr(argv[1]); sn = gethostbyaddr((char *)&in, 4, AF_INET); if ( sn ) printf("%s\n", sn->h_name); else printf("?\n"); return 0; }
je te remerci pour ton code je testerai sa et je te tienderai o courant et encore merci :o
Partager