in misc/winbug-15048.cc [147:201]
int main() {
wchar_t *cmdline = GetCommandLineW();
int argc = 0;
wchar_t **argv = CommandLineToArgvW(cmdline, &argc);
const wchar_t *font_name = L"Lucida Console";
int font_height = 8;
int test_ch = 0xff12; // U+FF12 FULLWIDTH DIGIT TWO
for (int i = 1; i < argc; ++i) {
const std::wstring arg = argv[i];
const std::wstring next = i + 1 < argc ? argv[i + 1] : L"";
if (arg == L"-face" && i + 1 < argc) {
font_name = argv[i + 1];
i++;
} else if (arg == L"-face-gothic") {
font_name = kMSGothic;
} else if (arg == L"-face-simsun") {
font_name = kNSimSun;
} else if (arg == L"-face-minglight") {
font_name = kMingLight;
} else if (arg == L"-face-gulimche") {
font_name = kGulimChe;
} else if (arg == L"-h" && i + 1 < argc) {
font_height = _wtoi(next.c_str());
i++;
} else if (arg.c_str()[0] != '-') {
test_ch = wcstol(arg.c_str(), NULL, 16);
} else {
printf("Unrecognized argument: %ls\n", arg.c_str());
usage(argv[0]);
}
}
const HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE);
set_font(font_name, font_height);
system("cls");
DWORD actual = 0;
wchar_t output[] = L"1234\n5678\n";
output[1] = test_ch;
WriteConsoleW(conout, output, 10, &actual, nullptr);
dump_region({ 0, 0, 3, 1 }, "both rows, 3 cols");
dump_region({ 0, 0, 4, 1 }, "both rows, 4 cols");
dump_region({ 0, 1, 4, 1 }, "second row");
dump_region({ 0, 0, 4, 0 }, "first row");
dump_region({ 1, 0, 4, 0 }, "first row, skip 1");
dump_region({ 2, 0, 4, 0 }, "first row, skip 2");
dump_region({ 3, 0, 4, 0 }, "first row, skip 3");
set_font(font_name, 14);
return 0;
}