From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id B25C3BC48 for ; Mon, 7 Mar 2005 14:57:57 +0100 (CET) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.191]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j27DvvA5006128 for ; Mon, 7 Mar 2005 14:57:57 +0100 Received: from [212.227.126.160] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1D8Ik9-0006ym-00; Mon, 07 Mar 2005 14:57:57 +0100 Received: from [80.129.117.94] (helo=gate.lan.gerd-stolpmann.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1D8Ik8-0005Oj-00; Mon, 07 Mar 2005 14:57:56 +0100 Received: from flakew.lan.gerd-stolpmann.de (flakew [192.168.0.32]) by gate.lan.gerd-stolpmann.de (Postfix) with ESMTP id 3758EC04B; Mon, 7 Mar 2005 14:57:56 +0100 (CET) Subject: Re: [Caml-list] printf and fork question From: Gerd Stolpmann To: Michael Cc: caml-list@yquem.inria.fr In-Reply-To: <20050307144422.1e67bef6.micha-1@fantasymail.de> References: <20050307144422.1e67bef6.micha-1@fantasymail.de> Content-Type: text/plain Date: Mon, 07 Mar 2005 14:57:55 +0100 Message-Id: <1110203875.5829.1.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:a6865a839c0178d9aa0ce41878507ea2 X-Miltered: at nez-perce with ID 422C5DE5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 printf:01 gerd:01 stolpmann:01 gerd:01 printf:01 getpid:01 waitpid:01 stdout:01 buffer:01 stdout:01 stolpmann:01 viktoriastr:01 64293:01 darmstadt:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Am Montag, den 07.03.2005, 14:44 +0100 schrieb Michael: > 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 You have three copies of the stdout buffer. Call "flush stdout" after printf. Gerd -- ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de ------------------------------------------------------------