Search code examples
file-ioconsole-applicationwindows-consolecrtwidechar

Get file translation mode of stdout


Function int _setmode(int, int) allows to switch stdout among ASCII and UTF (wide) modes.

Is there a function to read the current translation mode of stdout? Something like _getmode? In C# there is the Console.OutputEncoding property.

I'd like to use it for functions that can temporarily change the mode and then set back the original mode.


Solution

  • From the documentation:

    Return Value

    If successful, returns the previous translation mode.

    Using the return value allows to set back the original value.