* [Caml-list] Big-endian shorts
@ 2002-01-14 11:41 Florian Hars
2002-01-14 15:50 ` Eric C. Cooper
0 siblings, 1 reply; 2+ messages in thread
From: Florian Hars @ 2002-01-14 11:41 UTC (permalink / raw)
To: caml-list
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?
Yours, Florian Hars.
-------------------
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Big-endian shorts
2002-01-14 11:41 [Caml-list] Big-endian shorts Florian Hars
@ 2002-01-14 15:50 ` Eric C. Cooper
0 siblings, 0 replies; 2+ messages in thread
From: Eric C. Cooper @ 2002-01-14 15:50 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-01-14 15:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-14 11:41 [Caml-list] Big-endian shorts Florian Hars
2002-01-14 15:50 ` Eric C. Cooper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox