Version franaise
Home About Download Resources Contact us
Browse thread
Re: [Caml-list] input_line ... have i gone mad?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Wu <nickwu2000@h...>
Subject: Re: [Caml-list] input_line ... have i gone mad?
ah! :$ how embarassing. i assumed that an empty
standard input stream would be achieved by hitting enter,
rather than closing it with ctrl-d .. didn't think of that, it
does work fine d'oh!

thanks again!
nick


>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
>
>With the standard input, to get the End_of_file exception thrown, you 
>should
>close the stream by pressing ctrl+d.
>
>Regards,
>
>Francois
>
>2004&#8221;N 7&#338;&#381; 21&#8220; &#65533;&#8230;&#8212;j&#8220; 
>08:36&#65533;ANicolas Wu 
>&#8218;&#8218;&#8218;&#65533;&#8216;&#8218;&#8218;&#8218;&#8218;:
> > 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

_________________________________________________________________
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