• 로그인 함 해보끄나?

  • Sarangnamu.net June 17, 2003
    Home Login Profile Study Open Project Q&A Google Code
    유니코드(Unicode) -> char* or Multibyte -> Unicode
    Last Modify : 27 December, 2010(12:07)
    자주쓰는데도 길다보니 잊어묵는 사태..
    // Unicode Build 일때... Unicode -> char 로
    //
    CString szSrc;
    int nLen = szSrc.GetLength();
    char* pszDest = new char [nLen + 1];
    memset(pszDest, 0, nLen);
    WideCharToMultiByte(CP_ACP, 0, szSrc, -1, pszDest, nLen, NULL, NULL);
    
    // todo
    
    delete pszDest;
    
    // MultiByte Build 일때 ... char -> Unicode 로
    //
    char* pszSrc = "cast test";
    int nLen = strlen(pszSrc) + 1;
    wchar_t* pszwDest = new wchar_t[nLen];
    memset(szwDest , 0, nLen);
    int nLen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pszSrc, nLen - 1, pszwDest , nLen);
    
    // todo
    
    delete pszwDest;
    
    
    
    
    
    
    
    
    

    Comment


    입력하3 1508231826



    Locations of visitors to this page