AtlUnicodeToUTF8

Call this function to convert a Unicode string to UTF-8.

ATL_NOINLINE inline int AtlUnicodeToUTF8( 
   LPCWSTR wszSrc, 
   int nSrc, 
   LPSTR szDest, 
   int nDest  
) throw( );

Parameters

  • wszSrc
    The Unicode string to be converted

  • nSrc
    The length in characters of the Unicode string.

  • szDest
    Caller-allocated buffer to receive the converted string.

  • nDest
    The length in bytes of the buffer.

Return Value

Returns the number of characters for the converted string.

Remarks

To determine the size of the buffer required for the converted string, call this function passing 0 for szDest and nDest.

Requirements

Header: atlenc.h

See Also

Other Resources

Active Template Library (ATL) Concepts

ATL COM Desktop Components

ATL Functions Alphabetical Reference