caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Wu" <nickwu2000@hotmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] input_line ... have i gone mad?
Date: Tue, 20 Jul 2004 23:36:51 +0000	[thread overview]
Message-ID: <BAY22-F36q89MjwPQBy00008784@hotmail.com> (raw)

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


             reply	other threads:[~2004-07-20 23:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-20 23:36 Nicolas Wu [this message]
2004-07-21  0:01 ` Francois Burgisser
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=BAY22-F36q89MjwPQBy00008784@hotmail.com \
    --to=nickwu2000@hotmail.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;
as well as URLs for NNTP newsgroup(s).