From: Matt Boyd <mattwb78756@yahoo.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Setting the EOL character....
Date: Fri, 13 Sep 2002 10:52:40 -0500 [thread overview]
Message-ID: <3D8209C8.2020604@yahoo.com> (raw)
In-Reply-To: <200209131533.g8DFXwK30934@waco.inria.fr>
Bruno.Verlyck@inria.fr wrote:
> From: "Richard Lyman" <rich@lithinos.com>
> Date: Thu, 12 Sep 2002 20:36:45 -0600
>
> ... so then - there's no OCaml concept of a global EOL variable, or
> method that deals with reading in from a stream until the EOL??
>
I make no promises of efficiency or thread safety, but this should do
what you want:
let read_until n =
let buf = Buffer.create 100 in
fun st ->
let rec aux = function
| n' when n' = n ->
let str = Buffer.contents buf in
Buffer.reset buf;
str
| n' ->
Buffer.add_char buf n';
aux (Stream.next st);
in
aux (Stream.next st)
let read_until_null = read_until '\000'
>
> Bruno.
> -------------------
> 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
>
>
-------------------
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
next prev parent reply other threads:[~2002-09-16 10:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-13 2:24 Arturo Borquez
2002-09-13 2:36 ` Richard Lyman
2002-09-13 9:10 ` Alessandro Baretta
2002-09-13 15:33 ` Bruno.Verlyck
2002-09-13 15:52 ` Matt Boyd [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-09-13 0:07 Richard Lyman
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=3D8209C8.2020604@yahoo.com \
--to=mattwb78756@yahoo.com \
--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