Version française
Home     About     Download     Resources     Contact us    
Browse thread
printf and fork question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Fox <david.fox@l...>
Subject: Re: [Caml-list] printf and fork question
It looks like a side effect of Printf.printf.  Try prerr_endline 
(Printf.sprintf "Hi! %d\n" (getpid ())) instead.

Michael wrote:

>Hi,
>
>I don't understand why this:
>
>open Unix;;
>let _ = 
>	Printf.printf "Hi! %d\n" (getpid());
>	match fork() with
>	| 0 -> if fork() <> 0 then exit 0;
>	       ()
>	| id -> ignore (waitpid [] id)
>
>prints out that:
>Hi! 12215
>Hi! 12215
>Hi! 12215
>
>
>with ocaml 3.08.2. Any hints?
>
> Michael
>
>_______________________________________________
>Caml-list mailing list. Subscription management:
>http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
>Archives: http://caml.inria.fr
>Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>Bug reports: http://caml.inria.fr/bin/caml-bugs
>  
>
--

This message contains information which may be confidential and privileged. Unless you are the 
addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone 
the message or any information contained in the message. If you have received the message in error, 
please advise the sender and delete the message.  Thank you.