WSTOS

포스트: 1|아이템:WSTOS(1)
Tags

Posts

1 post

[C++11] 표준 라이브러리만을 이용한 std::string 과 std::wstring 간의 변환방법

가끔 유니코드 문자열을 인자로 받는 함수에 멀티바이트로 저장한 문자열을 넘겨줘야 할 때, 또는 그 반대의 경우에 유용한 함수이다. Locale은 원하는 국가코드를 집어넣으면 된다. #include #include #include inline std::wstring s_to_ws(const std::string& str, std::locale Loc = std::locale("ko")){using conv_Ty = std::codecvt_utf8_utf16;return std::wstring_convert { &std::use_facet