From owner-freebsd-questions Sat Oct 19 4:48:51 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 5F34737B401 for ; Sat, 19 Oct 2002 04:48:50 -0700 (PDT) Received: from mailc.telia.com (mailc.telia.com [194.22.190.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1872C43E7B for ; Sat, 19 Oct 2002 04:48:39 -0700 (PDT) (envelope-from erikt@midgard.homeip.net) Received: from d1o913.telia.com (d1o913.telia.com [195.252.44.241]) by mailc.telia.com (8.12.5/8.12.5) with ESMTP id g9JBm4Q3028040 for ; Sat, 19 Oct 2002 13:48:04 +0200 (CEST) X-Original-Recipient: Received: from falcon.midgard.homeip.net (h76n3fls20o913.telia.com [213.67.148.76]) by d1o913.telia.com (8.8.8/8.8.8) with SMTP id NAA28546 for ; Sat, 19 Oct 2002 13:47:58 +0200 (CEST) Received: (qmail 3111 invoked by uid 1001); 19 Oct 2002 11:47:56 -0000 Date: Sat, 19 Oct 2002 13:47:56 +0200 From: Erik Trulsson To: Angelin Lazarov Lalev Cc: questions@freebsd.org Subject: Re: C programming help ? Message-ID: <20021019114756.GA3069@falcon.midgard.homeip.net> Mail-Followup-To: Angelin Lazarov Lalev , questions@freebsd.org 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 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)? htonl(3), ntohl(3), htons(3) and ntohs(3) seems to be exactly what you need. -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message