-
-
Save mattn/2a70cfc0de2aebf30bd67aba51b74366 to your computer and use it in GitHub Desktop.
WriteConsoleOutputW is broken on Windows 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <stdio.h> | |
int | |
main(int argc, char* argv[]) { | |
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); | |
CHAR_INFO ci[3] = {}; | |
COORD buffer_size = { 3, 1 }; | |
COORD start_coord = { 0, 0 }; | |
SMALL_RECT sr = { 0, 0, 80, 25 }; | |
SHORT white = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; | |
ci[0].Char.UnicodeChar = L'あ'; | |
ci[0].Attributes = white; | |
ci[1].Char.UnicodeChar = L'い'; | |
ci[1].Attributes = white; | |
ci[2].Char.UnicodeChar = L'う'; | |
ci[2].Attributes = white; | |
WriteConsoleOutputW(h, (CHAR_INFO*)ci, buffer_size, start_coord, &sr); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code above is broken. Below should work correctly.