IP ADDRESS OF MACHINE
Nelson Guedes Paulo Junior
npaulo@linux.ime.usp.br
Thu Feb 28 06:03:00 GMT 2002
Hi,
I,ve tryed the following program on my machine (Debian) and
got the following address line:
address: 4294967232.4294967208.4294967280.4294967243
GCC Version:
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
gcc version 2.95.2 20000220 (Debian GNU/Linux)
What's wrong?
Should I use some special options on GCC?
I've compiled with -Wall and no warnings have apeared.
Thanks.
-----
Nelson Guedes Paulo Junior
E-mail: <npaulo@linux.ime.usp.br> UIN: 2489382 (Tender [:alpha:]*)
"LAPTOPirose é a doença causada pela urina do mouse"
On Thu, 28 Feb 2002, Andrea 'Fyre Wyzard' Bocci wrote:
> I have this one working on my Linux machine:
>
> /* ip.c */
> #include <unistd.h>
> #include <netdb.h>
>
> #define SIZE 256
>
> char hostname[SIZE];
> char **alias;
> char **entry;
> struct hostent *host;
>
> int main (int argc, char **argv) {
> gethostname (hostname, SIZE);
> host = gethostbyname (hostname);
>
> printf ("host name: %s\n", host->h_name);
> for (alias = host->h_aliases; *alias; alias++)
> printf ("alias: %s\n", *alias);
> for (entry = host->h_addr_list; *entry; entry++)
> printf ("address: %hhu.%hhu.%hhu.%hhu\n", \
> (*entry)[0], (*entry)[1] , (*entry)[2] , (*entry)[3]);
>
> return 0;
> }
> /* end of ip.c */
>
> The output is
>
> host name: stufis06.fisica.unifi.it
> alias: stufis06
> address: 150.217.141.25
>
> HTH, fwyzard
>
>
More information about the Gcc-help
mailing list