caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: Jonathan Roewen <jonathan.roewen@gmail.com>
Cc: OCaml <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] really_input won't read in an entire file...
Date: Mon, 10 Apr 2006 17:28:12 +0200	[thread overview]
Message-ID: <1144682892.10754.6.camel@localhost.localdomain> (raw)
In-Reply-To: <ad8cfe7e0604080358h548b0d6vaac6ed275e7232fb@mail.gmail.com>

Am Samstag, den 08.04.2006, 22:58 +1200 schrieb Jonathan Roewen:
> Hi,
> 
> Here's an example running in the toplevel, which doesn't seem to work:
> 
> # let ic = open_in "C:/texture.raw";;

Use open_in_bin. Looks like a text/binary mode problem.

> val ic : in_channel = <abstr>
> # let len = in_channel_length ic;;
> val len : int = 196608
> # let buf = String.create len;;
> val buf : string = ....
> # really_input ic buf 0 len;;
> Exception: End_of_file.
> 
> Is reading it chunk-by-chunk the only reliable way to read in an
> entire file? Seems fairly useless to me...
> 
> Jonathan
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 
-- 
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714
------------------------------------------------------------


  reply	other threads:[~2006-04-10 15:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-08 10:58 Jonathan Roewen
2006-04-10 15:28 ` Gerd Stolpmann [this message]
2006-04-10 15:31   ` Jonathan Roewen

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=1144682892.10754.6.camel@localhost.localdomain \
    --to=info@gerd-stolpmann.de \
    --cc=caml-list@yquem.inria.fr \
    --cc=jonathan.roewen@gmail.com \
    /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).