caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] input_line ... have i gone mad?
@ 2004-07-21 10:35 Nicolas Wu
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Wu @ 2004-07-21 10:35 UTC (permalink / raw)
  To: francois, caml-list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] input_line ... have i gone mad?
  2004-07-20 23:36 Nicolas Wu
@ 2004-07-21  0:01 ` Francois Burgisser
  0 siblings, 0 replies; 3+ messages in thread
From: Francois Burgisser @ 2004-07-21  0:01 UTC (permalink / raw)
  To: Nicolas Wu, caml-list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Caml-list] input_line ... have i gone mad?
@ 2004-07-20 23:36 Nicolas Wu
  2004-07-21  0:01 ` Francois Burgisser
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Wu @ 2004-07-20 23:36 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-21 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-21 10:35 [Caml-list] input_line ... have i gone mad? Nicolas Wu
  -- strict thread matches above, loose matches on Subject: below --
2004-07-20 23:36 Nicolas Wu
2004-07-21  0:01 ` Francois Burgisser

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).