Re: [m-users.] Coupling stdout and stderr

Julien Fischer <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
Hi Volker,

On Mon, 13 Mar 2023, Volker Wysk wrote:

> In C++ (and Haskell, I think) there's a feature which causes stdout to be
> flushed before writing something to stderr. I'm not sure how this is called.
> This way, the output on both streams occurs in the right order. Arbitrary
> streams can be coupled that way.

In C++ you can tie an istream to an ostream using the tie() function. Is
that what you were thinking of? It wouldn't help in this case because
cerr and cout are both ostreams.

> I've looked through the io library, but couldn't find anything like that.
> When you have a lot of output on stdout and then output something on stderr,
> the order gets messed up. You have to manually flash stdout before writing
> to stderr.

You could probably write something using the stdlib's stream interface
that did that.

Julien.
_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.