::NPTEAM:: Network Programer Team

검색 :
RSS 구독 : 글 / 댓글 / 트랙백 / 글+트랙백

ifstream 사용시, 한글 파일을 못 읽는 문제


vs2005에서 ifstream으로 파일명이 한글로된 파일을 읽지 못하는 문제가 생긴다.
이 때는 아래의 코드를 main에 추가해서 사용하자.
#include < locale >
  
setlocale( LC_ALL, "Korean" );  // Console 화면에 한국어 출력
파일 출력이 한글로 나오지 않을 때,
#include < fstream >

int _tmain(int argc, _TCHAR* argv[])
{
	std::locale::global( std::locale("Korean") );

	std::wofstream fstream;
	fstream.open( _T("Test1.txt") );

	fstream << _T("한글 파일 출력 테스트") << std::endl;

	fstream.close();

	return 0;
}
2007/12/30 11:02 2007/12/30 11:02

맨 위로