LPCWSTR <-> char 변환

|

// char to LPCWSTR
void CharToWChar( const char* pstrSrc, wchar_t pwstrDest[] )
{
        int nLen = ( int )strlen( pstrSrc ) + 1;
        mbstowcs( pwstrDest, pstrSrc, nLen );
}


// LPCWSTR to char
void WCharToChar( const wchar_t* pwstrSrc, char pstrDest[] )
{
      int nLen = ( int )wcslen( pwstrSrc );
      wcstombs( pstrDest, pwstrSrc, nLen + 1 );
}


필수적으로 windows.h 인클루드 해줘야 함

출처>http://yoonow.tistory.com/60

'메모 > C/C++' 카테고리의 다른 글

Direct2D and Direct3D Interoperability Overview  (0) 2012.04.04
Direct2D dpi, dip  (0) 2012.04.04
C 파일 입출력  (0) 2012.03.31
C 구조체 메모  (0) 2012.03.31
c++ 파일 입출력  (0) 2012.03.27
And
prev | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ··· | 9 | next