From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p941e5ep026015 for ; Tue, 4 Oct 2011 03:40:05 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnUBAJNjik7RVdK2mGdsb2JhbABChGajFQgiAQEBAQEICQ0HFCWBUwEBAQEDEgIPHQE4AQMMAQUFCw0CAiYCAiISAQUBHAYTIqNOCosJgyCEZokrAgQGgSeEYYETBJNhjRU9gUiCQg X-IronPort-AV: E=Sophos;i="4.68,482,1312149600"; d="scan'208";a="122668319" Received: from mail-iy0-f182.google.com ([209.85.210.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 04 Oct 2011 03:39:59 +0200 Received: by iadk27 with SMTP id k27so10637235iad.27 for ; Mon, 03 Oct 2011 18:39:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=f8pJ9dApyGBqULjlPzjrvvkt8WfG2dZrm1wFl+x3e8E=; b=TBEEvN7DlwUlSPyEFCsSyXvgshwqcW7Cro0Bd/8KyDsmk9PRO0KNIscawIgqOyELVV 20bTBOmc1OQNPlBnvIvo3KNGV1x7VHFy6B8a5MHk+MDfuFZMm/OgY0IpI/AR+wrdfHCh Yng7zZyQBEKq/bWR9ufJWZR6x24H/Fm0veFk0= MIME-Version: 1.0 Received: by 10.42.158.7 with SMTP id f7mr928475icx.89.1317692398259; Mon, 03 Oct 2011 18:39:58 -0700 (PDT) Sender: tcvena@gmail.com Received: by 10.42.227.138 with HTTP; Mon, 3 Oct 2011 18:39:58 -0700 (PDT) In-Reply-To: References: Date: Mon, 3 Oct 2011 21:39:58 -0400 X-Google-Sender-Auth: efny1jDlTukNQF46I4O78fLnvUA Message-ID: From: Taylor Venable To: Pierre Chopin Cc: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] Problem with un-flushed output getting mangled On Mon, Oct 3, 2011 at 15:00, Pierre Chopin wrote: > 2011/9/29 Taylor Venable >> >> Hi there, I'm having a problem with some code I've written. The gist >> of my program (whose code I unfortunately cannot share at this time, >> I'll have to get approval first) is this: >> >> 1. Read elements from an XML file and turn them into objects. >> 2. Place these objects into hash tables. >> 3. Do some stuff with those objects. >> 4. Print them out to various files (depending on the type of the object). >> >> My trouble is this: if I fail to call flush on the output channels in >> step #4, I get mangled output. > > Do you have more than one output channel on the same file open at the same > time ? I looked, and sure enough there was some old code that was writing the same file earlier in the program's execution, and it never closed the channel when it was done. Removing that other code fixed the problem. So even though the writing was never interleaved, I presume the buffering of the two channels interfered with each other and caused the problems I was seeing in the output. Thank you! -- Taylor C. Venable http://metasyntax.net/