RE: C programming help ?

2002-10-19 Thread Don Read

On 19-Oct-2002 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)?
> 
> 

http://www.faqs.org/rfcs/rfc1014.html>RFC 1014

man xdr

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- "Beer is proof that God loves us and wants us to be happy."

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: C programming help ?

2002-10-19 Thread Erik Trulsson
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)?

htonl(3), ntohl(3), htons(3) and ntohs(3) seems to be exactly what you
need.


-- 

Erik Trulsson
[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: C programming help ?

2002-10-19 Thread Matthew Seaman
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 [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



C programming help ?

2002-10-19 Thread Angelin Lazarov Lalev
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)?


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message