From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA22819; Mon, 3 Sep 2001 22:02:14 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA22882 for ; Mon, 3 Sep 2001 22:02:13 +0200 (MET DST) Received: from chopin.ai.univie.ac.at (chopin.ai.univie.ac.at [131.130.174.170]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f83K2C106827 for ; Mon, 3 Sep 2001 22:02:12 +0200 (MET DST) Received: (from markus@localhost) by chopin.ai.univie.ac.at (8.9.3/8.9.3/Debian 8.9.3-21) id WAA08811; Mon, 3 Sep 2001 22:02:08 +0200 Date: Mon, 3 Sep 2001 22:02:08 +0200 From: Markus Mottl To: Michael Leary Cc: caml Subject: Re: [Caml-list] flushing stdout with flush stdout not good? Message-ID: <20010903220208.C8034@chopin.ai.univie.ac.at> References: <20010903122740.A11704@ip178.usw22.rb1.bel.nwlink.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010903122740.A11704@ip178.usw22.rb1.bel.nwlink.com>; from leary@nwlink.com on Mon, Sep 03, 2001 at 12:27:40 -0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, 03 Sep 2001, Michael Leary wrote: > I'm programming a realtime bot (as you may know :) and using printf > with a newline terminated format string followed by a call of fse ( > short for "flush stdout" in my prog) really doesn't work very well at > flushing stdout -- commands don't get read properly by the system, > and get processed in chunks, rather than as sent. For some reason > calling print_newline is amazingly more effective, i.e. leaving the > newline out of the printf format string, and letting print_newline () > take care of it. I guess you are using the Format-module, not the Printf-module. The latter works directly on the stdout buffer, whereas the first maintains a "pretty-printing buffer" where it can break lines as required. You can use "print_flush" or "@?" within the format string to flush things. But be careful: the latter closes all open pretty-printing boxes as is logically necessary for this operation so better do this only when all boxes are closed anyway (or you are sure that you want to have them all closed). If you don't need automatic line-breaking functionality, the "Printf"-module is just fine. Regards, Markus Mottl -- Markus Mottl markus@oefai.at Austrian Research Institute for Artificial Intelligence http://www.oefai.at/~markus ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr