Created
March 14, 2018 15:50
-
-
Save Arkanosis/6a1b449452ad396e6a2729a081616227 to your computer and use it in GitHub Desktop.
Break std::strftime using a Japanese CP932 locale on Windows
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
#include <ctime> | |
#include <iostream> | |
#include <locale> | |
int main() { | |
std::locale::global(std::locale("Japanese_Japan.932")); | |
std::time_t t = std::time(nullptr); | |
char mbstr[20000]; | |
if (std::strftime(mbstr, sizeof (mbstr), "%Y年%m月%d日 %H:%M:%S", std::localtime(&t))) { | |
std::cout << mbstr << '\n'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment