This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

inet_ntoa on IRIX


o200 with IRIX 6.5.8m and gcc version 2.95.2 19991024 (release)
AND
o200 with IRIX 6.5.4m and gcc version 2.95 19990728 (release)

the source code :
#include <unistd.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#include <errno.h>

int main() {
struct sockaddr_in server;
char *name;

inet_aton("64.34.103.9", (struct in_addr *)&server.sin_addr);
name = (char *) inet_ntoa(server.sin_addr);
printf("%s\n", name);
}

compiled with gcc :
root@xxxxxxx ~ # gcc -o t testgcc.c
root@xxxxxxx ~ # ./t
0.0.0.0
(wrong!!!)

compiled with the sgi's cc :
root@xxxxxxx ~ # cc -o t testgcc.c
root@xxxxxxx ~ # ./t
64.34.103.9
(this is the correct one right ? and I have the same result on linux or openbsd)

Sorry if I'm writing about a known problem, but I couldn't find anything about this. I am not a big C specialist :)
 

-- 

Boyan Gadjev
UNIX Systems Administrator
VERIO Inc. 
877-272-2418 x.4337
 
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]