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;
}

반응형

+ Recent posts