[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Eric C. Cooper <ecc@c...> |
| Subject: | Re: [Caml-list] Big-endian shorts |
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