From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA18684; Mon, 14 Jan 2002 16:51:11 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA18662 for ; Mon, 14 Jan 2002 16:51:10 +0100 (MET) Received: from ux9.sp.cs.cmu.edu (UX9.SP.CS.CMU.EDU [128.2.220.166]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id g0EFp9T14320 for ; Mon, 14 Jan 2002 16:51:09 +0100 (MET) Received: from 12-226-37-231.client.attbi.com by ux9.sp.cs.cmu.edu id aa10590; 14 Jan 2002 10:50 EST Received: from ecc by stratocaster with local (Exim 3.33 #1 (Debian)) id 16Q9NR-0005fV-00 for ; Mon, 14 Jan 2002 10:50:25 -0500 Date: Mon, 14 Jan 2002 10:50:25 -0500 To: caml-list@inria.fr Subject: Re: [Caml-list] Big-endian shorts Message-ID: <20020114155025.GC21601@cmu.edu> Mail-Followup-To: caml-list@inria.fr References: <20020114114109.GB11310@quetelet.bik-gmbh.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020114114109.GB11310@quetelet.bik-gmbh.de> User-Agent: Mutt/1.3.25i From: "Eric C. Cooper" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, Jan 14, 2002 at 12:41:09PM +0100, Florian Hars wrote: > What is the preferred way to read a file with fixed-length records > consisting of 2700 unsigned, bigendian short ints each in Ocaml? > Everything is a string? You can use Bigarray with int16_{signed,unsigned} elements obtained via map_file. If you want portability (i.e. on a little-endian platform), you can optionally byte-swap the int16s arithmetically. Or you can manipulate chars in a string as you suggest. -- Eric C. Cooper e c c @ c m u . e d u ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr