Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] error opening large file
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Olivier Andrieu <oandrieu@n...>
Subject: Re: [Caml-list] error opening large file
 Garry Hodgson [Friday 11 January 2002] :
 > 
 > i get the following error when i open a large file (2561435180 bytes):
 > 
 >    let chan = open_in( "com.zone" );;
 >    Uncaught exception:
 >    Sys_error
 >    "com.zone: Value too large for defined data type".
 > 
 > is there a 2G file size limitation? if so, why?

The problem might be with your C library which doesn't use 64 bits
file offsets for the usual I/O functions (open, lseek ...). On my
redhat 7.2, opening a >2G file works OK.

BUT, looking at the ocaml source code, I see that the offset in the
file is coded with a 'long' which is a bit problematic.

Maybe some I/O funtions with int64 arguments could be added to the
standard library (at least for the low-level functions of module
Unix) ?


        Objective Caml version 3.04

# let ic = open_in "hom.genom.fa" ;;
val ic : in_channel = <abstr>
# let s = String.make 20 ' ' ;;                         
val s : string = "                    "
# let _ = input ic s 0 20 in s ;;
- : string = ">chr10\nCCGTGGTGAAGAC"
# in_channel_length ic ;;
- : int = -848525384
#

-- 
   Olivier
-------------------
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