프로그래밍(Programming)/c++, 11, 14 , 17, 20
[c++]유니코드로 한글쓰기
3DMP
2012. 11. 4. 15:40
Link : http://kldp.org/node/26526
// korText.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
wstring aa = L"abcde 입니다.";
wfstream filestr;
filestr.imbue(locale( "korean" ) ); // 이게 중요
filestr.open (L"C:\test.txt", wfstream::in | wfstream::out | wfstream::app);
filestr.write(aa.c_str(), static_cast<streamsize>(aa.length()));
filestr.close();
return 0;
}
반응형