MBCS (Muiti Byte Character Set)
한글은 2byte, 영문은 1byte

WBCS (Wide Byte Character Set)
문자 표현시 2byte (UNICODE)

 

MBCS와 WBCS를 동시 지원하게 코드를 만들고 싶으면 

아래의 매크로를 만들어서 사용합시다.

 

#ifdef UNICODE
typedef WCHAR TCHAR;
typedef LPWSTR LPTSTR;
typedef LPCWSTR LPCTSTR;
#else
typedef CHAR TCHAR:
typedef LPSTR LPTSTR;
typedef LPCSTR LPCTSTR;
#endif

#ifdef _UNICODE
#define __T(x) L ## x
#else
#define __T(x) x
#endif

#define _T(x) __T(x)
#define _TEXT(x) __T(x)

동시지원용으로 기본 함수들을 사용할 때는 이미 만들어져있으므로 _t로 되어있는 함수를 사용합시다.

사용할때는 Windows.h 헤더파일을 선언해야되고 wbcs를 사용하려면 #define _UNICODE를 해줍시다.

동시지원용 wbcs mbcs
_tmain wmain main
_tcslen wcslen strlen
_tprintf wprintf printf
_tscanf wscanf scanf
... ... ...

 

+ Recent posts