caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Arbitrarily throwing End_of_file
@ 2003-11-10  1:16 Michael Hoisie
  2003-11-10  2:47 ` Brian Hurt
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Hoisie @ 2003-11-10  1:16 UTC (permalink / raw)
  To: caml-list

I have a file which is approximately 278,440 lines of text (more specifically, it is the result of doing 'ls -lAR /')

I was trying to write this relatively simple program to analyze it but it seems that End_of_file was thrown very early. 

To test, it, I made a simple function:  

let rec count_lines file n =
    try let str = input_line file in
    count_lines file (n + 1)
    with End_of_file -> Printf.printf "The file is %d\n lines long" n

and ran it with something like:
    let file = open_in "longfile.dat" in
    count_lines file 0

The result was 26187.

count_lines is a stripped-down version of the original function i used to analyze the file. If I used the original, it threw an End_of_file at line 23806. 

I'm running 3.07+2 on FreeBSD 4.9
any suggestions?
-mike

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-11-10  1:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-10  1:16 [Caml-list] Arbitrarily throwing End_of_file Michael Hoisie
2003-11-10  2:47 ` Brian Hurt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).