Last active
April 27, 2017 22:34
-
-
Save elieux/39922160f46c6b634654917b2eb598e1 to your computer and use it in GitHub Desktop.
Print wide characters
This file contains hidden or 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
// > gcc -Wall -Wextra -municode -std=c11 -o xecho.exe echo.c | |
#define WIN32_LEAN_AND_MEAN 1 | |
#define __USE_MINGW_ANSI_STDIO 1 | |
#include <stdio.h> | |
#include <wchar.h> | |
#include <io.h> | |
#include <fcntl.h> | |
int wmain(int argc, wchar_t *argv[]) { | |
_setmode(_fileno(stdout), _O_U16TEXT); | |
for (int i = 1; i < argc; ++i) { | |
if (i > 1) { | |
wprintf(L" "); | |
} | |
wprintf(L"%ls", argv[i]); | |
} | |
wprintf(L"\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment