caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Francois Burgisser <francois@ist.fujitsu.com>
To: "Nicolas Wu" <nickwu2000@hotmail.com>, caml-list@inria.fr
Subject: Re: [Caml-list] input_line ... have i gone mad?
Date: Wed, 21 Jul 2004 09:01:02 +0900	[thread overview]
Message-ID: <200407210901.03068.francois@ist.fujitsu.com> (raw)
In-Reply-To: <BAY22-F36q89MjwPQBy00008784@hotmail.com>

With the standard input, to get the End_of_file exception thrown, you should 
close the stream by pressing ctrl+d.

Regards,

Francois

2004年 7月 21日 水曜日 08:36、Nicolas Wu さんは書きました:
> Hey all, i'm trying to write a very simple program using input_line to grab
> input from stdin ... but it is going horribly wrong! try putting the
> following
> in a toplevel:
>
> <<cut>>
> open Printf;;
>
> let main () =
> try
> printf "start";
> while true do
>   printf "just before"; flush stdout;
>   let line = input_line stdin in
>   printf "print the line %s" line
> done
> with End_of_file ->
> printf "should exit";;
>
> main () ;;
> <<cut>>
>
> on my machine, it works fine, but never reaches the "should exit" line-
> it seems like the End_of_file exception is never thrown - this is the same
> even if i use read_line () instead of input_line.... what am i doing wrong?
>
> thanks!
>
> nick
>
> _________________________________________________________________
> It's fast, it's easy and it's free. Get MSN Messenger today!
> http://www.msn.co.uk/messenger
>
> -------------------
> 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


  reply	other threads:[~2004-07-21  0:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-20 23:36 Nicolas Wu
2004-07-21  0:01 ` Francois Burgisser [this message]
2004-07-21 10:35 Nicolas Wu

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=200407210901.03068.francois@ist.fujitsu.com \
    --to=francois@ist.fujitsu.com \
    --cc=caml-list@inria.fr \
    --cc=nickwu2000@hotmail.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).