Skip to content

Instantly share code, notes, and snippets.

@mattn
Created August 17, 2019 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/205b43f05bc2ec1275cb8a813bd0dc64 to your computer and use it in GitHub Desktop.
Save mattn/205b43f05bc2ec1275cb8a813bd0dc64 to your computer and use it in GitHub Desktop.
#include <windows.h>
#include <stdio.h>
int
main(int argc, char* argv[]) {
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
CHAR_INFO ci[6] = {};
COORD buffer_size = { 6, 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;
ci[3].Char.UnicodeChar = L' ';
ci[3].Attributes = white;
ci[4].Char.UnicodeChar = L'う';
ci[4].Attributes = white;
ci[5].Char.UnicodeChar = L' ';
ci[5].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