* [Caml-list] no tell on files? @ 2003-02-05 3:14 Chris Hecker 2003-02-05 3:36 ` Ed L Cashin 0 siblings, 1 reply; 3+ messages in thread From: Chris Hecker @ 2003-02-05 3:14 UTC (permalink / raw) To: caml-list There appears to be no "tell" function on pervasives streams or Unix file descriptors. Is there a reason for this? The combination of that plus the lack of a pervasives relative seek makes it hard to move around in files without keeping parallel information. Thanks, Chris ------------------- 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] 3+ messages in thread
* Re: [Caml-list] no tell on files? 2003-02-05 3:14 [Caml-list] no tell on files? Chris Hecker @ 2003-02-05 3:36 ` Ed L Cashin 2003-02-05 3:52 ` Chris Hecker 0 siblings, 1 reply; 3+ messages in thread From: Ed L Cashin @ 2003-02-05 3:36 UTC (permalink / raw) To: Chris Hecker; +Cc: caml-list Chris Hecker <checker@d6.com> writes: > There appears to be no "tell" function on pervasives streams or Unix > file descriptors. Is there a reason for this? The combination of > that plus the lack of a pervasives relative seek makes it hard to move > around in files without keeping parallel information. Seek is tell! The program below gives this output: ecashin@meili seek-tell$ ./a.out read 10 chars: " Unix.SEEK" let main = let fd = Unix.openfile "main.ml" [Unix.O_RDONLY] 0 in let end_pos = Unix.lseek fd 0 Unix.SEEK_END in let half_pos = Unix.lseek fd (end_pos/2) Unix.SEEK_SET and buf = String.create 1024 in Printf.printf "read %d chars: \"%s\"\n" (UnixLabels.read fd ~buf ~pos:0 ~len:10) buf ;; main -- --Ed L Cashin | PGP public key: ecashin@uga.edu | http://noserose.net/e/pgp/ ------------------- 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] 3+ messages in thread
* Re: [Caml-list] no tell on files? 2003-02-05 3:36 ` Ed L Cashin @ 2003-02-05 3:52 ` Chris Hecker 0 siblings, 0 replies; 3+ messages in thread From: Chris Hecker @ 2003-02-05 3:52 UTC (permalink / raw) To: Ed L Cashin; +Cc: caml-list >Seek is tell! Aha! It's undocumented, but now I notice the "-> int" on the call! And I just noticed pos_in|out in the pervasives. I swear it wasn't there this afternoon. I looked, really! :) I'm a dork! Sorry for wasting bandwidth and time, and thanks! Chris PS. Maybe the docs for Unix and Pervasives should have the word "tell" in them so that a text search can find these functions for "c people". ------------------- 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] 3+ messages in thread
end of thread, other threads:[~2003-02-05 8:43 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-02-05 3:14 [Caml-list] no tell on files? Chris Hecker 2003-02-05 3:36 ` Ed L Cashin 2003-02-05 3:52 ` Chris Hecker
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox