From owner-freebsd-chat Fri Nov 2 8:15:21 2001 Delivered-To: freebsd-chat@freebsd.org Received: from web11504.mail.yahoo.com (web11504.mail.yahoo.com [216.136.172.36]) by hub.freebsd.org (Postfix) with SMTP id 32C4737B407 for ; Fri, 2 Nov 2001 08:15:19 -0800 (PST) Message-ID: <20011102161519.40762.qmail@web11504.mail.yahoo.com> Received: from [200.68.128.36] by web11504.mail.yahoo.com via HTTP; Fri, 02 Nov 2001 08:15:19 PST Date: Fri, 2 Nov 2001 08:15:19 -0800 (PST) From: Fabio Miranda Subject: struct hostent To: freebsd-chat@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi, i am coding a small c program in order to learn network programming: main(int argc, char *argv[]){ struct hostent *host; .... if((host=gethostbyname(argv[1])=NULL)){ perror("gethostbyname"); exit(-1);} /* now, i want to print out all the hostent struct information */ printf("struct hostent{\n"); printf("char *h_name: %s", host->h_name); printf("char **h_aliases:%s\n", host->h_length); printf("int h_addrtype: %d\n", host->h_addrtype); printf("int h_length: %d\n", host->h_length); printf("char **h_addr_list: %d\n", host->h_addr_list); } } This program core dumped, it may crash because i am trying to print an char array (h_addr_list, right?), I want to know how can i print all the information store in a struct hostent?, especiality the ip address. thanks __________________________________________________ Do You Yahoo!? Find a job, post your resume. http://careers.yahoo.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message