One more thing about _setmode. You may know that CRT's fwide[1] is just a stub and it is even documented to do nothing. If there would be a reliable and consistent way to obtain translation mode, it would be possible to implement working replacement for it.
_setmode is CRT stuff, so I think it is safe enough to assume that POSIX applications will not call it. ISO C way to achieve similar thing is fwide. In theory, implementation could track which FILEs were put to "wide" mode and implementation of printf/scanf could make use of this information. Also, if I remember correctly, ISO C says that once stream mode was set with either fwide or explicit I/O operation it cannot be changed and corresponding (narrow or wide) versions of stdio functions must be used to perform I/O on that stream. In practice, it seems that some implementation (CRT and glibc for example) are ok with mixing them. [1] https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/fwide _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
