caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus@mail4.ai.univie.ac.at>
To: Michael Leary <leary@nwlink.com>
Cc: caml <caml-list@inria.fr>
Subject: Re: [Caml-list] flushing stdout with flush stdout not good?
Date: Mon, 3 Sep 2001 22:02:08 +0200	[thread overview]
Message-ID: <20010903220208.C8034@chopin.ai.univie.ac.at> (raw)
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

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


  reply	other threads:[~2001-09-03 20:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-03 19:27 Michael Leary
2001-09-03 20:02 ` Markus Mottl [this message]
2001-09-04  1:59   ` Michael Leary
2001-09-04  2:31     ` Michael Leary
2001-09-04  2:40       ` Alexander V. Voinov
2001-09-04  2:53       ` Jon Moore
2001-09-04 17:55         ` Michael Leary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010903220208.C8034@chopin.ai.univie.ac.at \
    --to=markus@mail4.ai.univie.ac.at \
    --cc=caml-list@inria.fr \
    --cc=leary@nwlink.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).