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

Volker Wysk <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
Am Mittwoch, dem 15.03.2023 um 14:12 +1100 schrieb Julien Fischer:
> 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? 

Yes.

> It wouldn't help in this case because
> cerr and cout are both ostreams.

Yes, I was mistaken. But it would still make sense to tie stdout to stderr,
wouldn't it?

> 
> > 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.

I'll take a look next time I need it.

Thanks

Volker

_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmQRmCkACgkQ+K4ydFOs
HoXlahAAm+pRO7RqgaDu+nwIOpGu/JZiJ4Xj6MY1TXSGOCbvUEr/+LgkGhMgsVKm
samJEMdVc29dUZgzxtspSrTdGSF4tHB3xD5gI4blmHsG8aTFgDxfWRzuDDwJDUU3
aJRNx9HG2ZXH0h/C4Gv3EJATXba0rapPrqSDDXUY4IfNwy+Zai9vLlRF1WxfRSoD
QrHJB1iXzoVQHcMm07HVgwjhtSqMdValkAR/HNDILB9Z9bdes8ZbJqay/vmnw+Ts
LhTN6R7OTc3NdjGuA1TpFmnMifyEZKsdBVqlb3ZGZPI4ur0BHQP4iNt68rPcifoy
jnc7s6kuiW3+PxVAUwku9WC5i5n30duHdS8vHwEnHCTmY9m9DYWnd5b4S+5eeqGA
ddHsanjEQUnHCTsKCCK1s7e8sGCaplIjLBU+DCiJ3kD7vO58j9yEs33pgwSXc+N4
xYsr5uAXZVYefq+3hDC5MoUBKXiXwM8opoVekVgfp0o07Ne/Tbwa2Gy6QAQ7UK0S
6m2GCig6nedavxHGuz1w6AJqKnNhDebpmSk6A8ah/OpqAFWCd+A1HdwWpgfLehc5
ok7xPwstsq8FIy29OT4tnXkjPNH9r0jYE83K6o/p5aU14uUnP6cJdF3xbrOE8xlr
4LIv5T5bAI2KQkisCakroNtOxqiaXV7BUMGof+ew8CCktUQxPHs=
=9Frw
-----END PGP SIGNATURE-----
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.