Partager via


CA2AEX Class

This class is used by the string conversion macros CA2TEX and CT2AEX, and the typedef CA2A.

Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

template< 
int t_nBufferLength= 128 
> 
class CA2AEX

Parameters

  • t_nBufferLength
    The size of the buffer used in the translation process. The default length is 128 bytes.

Members

Public Constructors

Name

Description

CA2AEX::CA2AEX

The constructor.

CA2AEX::~CA2AEX

The destructor.

Public Operators

Name

Description

CA2AEX::operator LPSTR

Conversion operator.

Public Data Members

Name

Description

CA2AEX::m_psz

The data member that stores the source string.

CA2AEX::m_szBuffer

The static buffer, used to store the converted string.

Remarks

Unless extra functionality is required, use CA2TEX, CT2AEX, or CA2A in your own code.

This class contains a fixed-size static buffer which is used to store the result of the conversion. If the result is too large to fit into the static buffer, the class allocates memory using malloc, freeing the memory when the object goes out of scope. This ensures that, unlike text conversion macros available in previous versions of ATL, this class is safe to use in loops and that it won't overflow the stack.

If the class tries to allocate memory on the heap and fails, it will call AtlThrow with an argument of E_OUTOFMEMORY.

By default, the ATL conversion classes and macros use the current thread's ANSI code page for the conversion.

The following macros are based on this class:

  • CA2TEX

  • CT2AEX

The following typedef is based on this class:

  • CA2A

For a discussion of these text conversion macros, see ATL and MFC String Conversion Macros.

Example

See ATL and MFC String Conversion Macros for an example of using these string conversion macros.

Requirements

Header: atlconv.h

See Also

Reference

CA2CAEX Class

CA2WEX Class

CW2AEX Class

CW2CWEX Class

CW2WEX Class

Other Resources

ATL Class Overview