From owner-freebsd-questions Sat Oct 19 4:36:32 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3DB4137B401 for ; Sat, 19 Oct 2002 04:36:31 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (happy-idiot-talk.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4EB0143E75 for ; Sat, 19 Oct 2002 04:36:30 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) by smtp.infracaninophile.co.uk (8.12.6/8.12.6) with ESMTP id g9JBaTei066582; Sat, 19 Oct 2002 12:36:29 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost) by happy-idiot-talk.infracaninophile.co.uk (8.12.6/8.12.6/Submit) id g9JBaOhA066581; Sat, 19 Oct 2002 12:36:24 +0100 (BST) Date: Sat, 19 Oct 2002 12:36:24 +0100 From: Matthew Seaman To: questions@FreeBSD.ORG Cc: Angelin Lazarov Lalev Subject: Re: C programming help ? Message-ID: <20021019113624.GB66358@happy-idiot-talk.infracaninophi> Mail-Followup-To: Matthew Seaman , questions@FreeBSD.ORG, Angelin Lazarov Lalev References: <3DB13F5D.1060908@uni-svishtov.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3DB13F5D.1060908@uni-svishtov.bg> User-Agent: Mutt/1.5.1i X-Spam-Status: No, hits=-13.4 required=5.0 tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01, USER_AGENT,USER_AGENT_MUTT version=2.41 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Oct 19, 2002 at 02:17:49PM +0300, Angelin Lazarov Lalev wrote: > I need to convert some bytes, which are not an internet address, from > machine to network byte order (described in RFC1700). I could do it > mannualy, assuming a I386 (or some other) architecture, but then my code > will be a lot less portable. Is there any function in libc or somewhere > else which will do that conversion for me (and will be updated when new > architecture is added)? inet_ntoa(3), inet_aton(3) will do that conversion for you[*]. Cheers, Matthew [*] Although the man page suggests that nowadays addr2ascii(3) and ascii2addr(3) should be preferred, but the current implementation of those functions is based on inet_ntoa(3), inet_aton(3). -- Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message