Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Oct 2002 12:36:24 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        questions@FreeBSD.ORG
Cc:        Angelin Lazarov Lalev <alalev@uni-svishtov.bg>
Subject:   Re: C programming help ?
Message-ID:  <20021019113624.GB66358@happy-idiot-talk.infracaninophi>
In-Reply-To: <3DB13F5D.1060908@uni-svishtov.bg>
References:  <3DB13F5D.1060908@uni-svishtov.bg>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021019113624.GB66358>