caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Basile STARYNKEVITCH <basile@starynkevitch.net>
To: caml-list@inria.fr
Subject: [Caml-list] Unix.lseek versus Pervasives.pos
Date: Tue, 18 Mar 2003 07:54:13 +0100	[thread overview]
Message-ID: <15990.49813.28217.829156@hector.lesours> (raw)
In-Reply-To: <2EECE9D8-58CA-11D7-A8F0-000393942C76@ece.ucsb.edu>

>>>>> "Shivkumar" == Shivkumar Chandrasekaran <shiv@ece.ucsb.edu> writes:

    Shivkumar> Hi, Currently I am trying to handle "LargeFiles" while
    Shivkumar> marshalling caml values and I have run into this
    Shivkumar> incidental problem (nothing to do with LargeFile). If I
    Shivkumar> open a file with "open_out_bin", write to it using
    Shivkumar> "output_value" 

You apparently forgot to flush the channel.

    Shivkumar> and then try to determine the position
    Shivkumar> in the file using "pos", I get the correct
    Shivkumar> value. However, if I use Unix.lseek thus

    Shivkumar> Unix.lseek (Unix.descr_of_out_channel fd_out) 0
    Shivkumar> Unix.SEEK_CUR

    Shivkumar> I get a different value (so far always 0) 


Forgetting to flush files on most systems should give similar
errors. Flushing files is not Ocaml specific, but a general issue (at
least under Unix, and probably Windows).

Perhaps the Ocaml manual could add as a hint to never forget flushing
files (but the tip might be there already), but this hint is very
basic & generic and is not Ocaml specific.

Regards.

-- 

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France

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


  reply	other threads:[~2003-03-18  6:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-17 22:45 Shivkumar Chandrasekaran
2003-03-18  6:54 ` Basile STARYNKEVITCH [this message]
     [not found] <46CF368E-5912-11D7-8289-000A95773ED2@rouaix.org>
2003-03-18 17:35 ` Shivkumar Chandrasekaran
2003-03-18 17:39 ` Shivkumar Chandrasekaran
2003-03-19 20:27   ` Xavier Leroy
2003-03-19 18:36 cashin
2003-03-19 18:48 ` Nicolas George
2003-03-19 19:01   ` cashin
2003-03-19 18:55 ` Ken Rose
2003-03-19 19:08 ` Basile STARYNKEVITCH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15990.49813.28217.829156@hector.lesours \
    --to=basile@starynkevitch.net \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).