ReactOS
0.4.16-dev-106-g10b08aa
gethostbyname.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <
winsock2.h
>
3
4
int
main
(
int
argc
,
char
**
argv
) {
5
WSADATA
wdata;
6
7
WSAStartup
( 0x0101, &wdata );
8
9
if
(
argc
> 1 ) {
10
struct
hostent
*he =
gethostbyname
(
argv
[1] );
11
if
( !he ) {
12
printf
(
"lookup of host %s failed: %d\n"
,
argv
[1],
WSAGetLastError
() );
13
return
1;
14
}
else
{
15
printf
(
"Lookup of host %s returned %s\n"
,
16
argv
[1],
inet_ntoa
(*((
struct
in_addr
*)he->
h_addr_list
[0])) );
17
return
0;
18
}
19
}
else
20
return
1;
21
}
argc
static int argc
Definition:
ServiceArgs.c:12
WSAStartup
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition:
startup.c:113
main
int main()
Definition:
test.c:6
printf
#define printf
Definition:
freeldr.h:97
gethostbyname
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
Definition:
getxbyxx.c:221
inet_ntoa
#define inet_ntoa(addr)
Definition:
inet.h:100
argv
#define argv
Definition:
mplay32.c:18
WSAData
Definition:
winsock.h:516
hostent
Definition:
winsock.h:133
hostent::h_addr_list
char ** h_addr_list
Definition:
winsock.h:138
in_addr
Definition:
tcpip.h:126
winsock2.h
WSAGetLastError
int PASCAL FAR WSAGetLastError(void)
Definition:
dllmain.c:112
modules
rostests
tests
gethostbyname
gethostbyname.c
Generated on Tue Oct 8 2024 06:12:00 for ReactOS by
1.9.6