[m-users.] How to get the file descriptor of a stream
Volker Wysk <[email protected]>
| Newsgroups | gmane.comp.lang.mercury.general |
|---|---|
| Message-ID | <[email protected]> |
Hi. I would like to have a predicate which returns the file descriptor, which is used to implement a stream. Such as the fileno(3) C library function. It's for querying the terminal width, of streams that can be connected to a terminal. I want to print (error and normal) messages which are formatted for the terminal's width. There's stdout_stream and stderr_stream and you can assume that they have the file descriptors 1 and 2. But this isn't foolproof and other streams might be connected to a terminal as well (or isn't it?). It might, for instance, theoretically happen that stdout_stream is closed and the file descriptor 1 gets reused later. Then we could end up with a fd 1 which doesn't belong to stdout_stream. I've searched the io and stream libraries, but couldn't find such a predicate. Cheers, Volker _______________________________________________ users mailing list [email protected] https://lists.mercurylang.org/listinfo/users
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmS4yQUACgkQ+K4ydFOs HoUdMg//e+RFeRqC8FxUd5Rotp//Qu/k3pHXNcmcjlyzdaXr072e0xY/+XJNBPMB 8LHLB9GNN3nSUjEyUpAHA/+zpvEvmpGxfUZuPtwdQgUsoH11w/bPHYUfz/m6w8nA Xp0L9HeDBlsQvEPNxUd65GxMUSH9avMMN07NlbclGu+Kz7YRP82Yvg4tQ2iIH/sY ZcFsf1YfKNPApawJh+Xcp5jNBHGmiXplorNfP6UjmNEuIGk33zygVYV26472u729 EMeBIAwZ0WZSHwSNcmxFzYlViAW601TWf3inWNsTo229gOk5ELEaLY1fcMp/PTSe wojmYVVld1QDpl2tG3pv8uEKhRCDYOaWnMuSOGzkr3Dsof7idfvjJ+3OcQnY06uX 3ZcR/pAaCiJ+6RI60ngD2T8R6SLT55MJRY0ZhK//jZM/BZJutqaEEigi5P3yXIDU xkK/Xleb+m0XmLd3AGpVfgveLoWi3h0KPWEV/yOQdlcMhJNCfl3MENbaldDMF2K8 JcUsmxbUQAIQSWUR0Yiwm4/AgPqmOKvLKRrtFRmTWiCQ5f3kLkPlvBfHlo/cOOoQ lxksP3b4gKQX9nW1TkvsomMPndw20FTeQ6kstVMD5zslVB6Kdl6MY+7MBo8g/Xj2 5u9kp4kV81tppmfiqGFjXUos9rq1DCGhfIh4Ww4ZsnJs3xh8uXc= =KyXC -----END PGP SIGNATURE-----