0

The thing is that MinGW compiled program has problems with printing non-ascii chars on console through wcout, the output may show characters from different codepage or be completely blank. But winapi WriteConsoleW works perfectly. So I ask if there is a possibility to change behavior of << operator so it would aways invoke winapi method.

(I didn't find any examples how to do it and I'm new to c++, there is lot of examples how to overload an object but not how to do it with string or wide char array.)

rsk82
  • 28,217
  • 50
  • 150
  • 240

1 Answers1

2

You can create a suitable stream buffer sending characters wherever you need to send them. You can use rdbuf() to set the stream buffer used by std::wcout. I don't think I have provided an example using wchar_t as character type in the past but it would work just as the plenty examples for char.

Nawaz
  • 353,942
  • 115
  • 666
  • 851
Dietmar Kühl
  • 150,225
  • 13
  • 225
  • 380