Share via


CSimpleStringT::operator PCXSTR

저장 된 문자를 직접 액세스 하는 CSimpleStringT 개체를 C 스타일 문자열로.

operator PCXSTR( ) const throw( );

반환 값

문자 데이터 문자열의 포인터입니다.

설명

문자가 복사 됩니다. 포인터에만 반환 됩니다.이 연산자에 주의 하십시오.변경할 경우는 CString 개체 문자 포인터를 가져온 다음 포인터를 무효화 하는 메모리를 재할당 될 수 있습니다.

예제

다음 예제에서는 CSimpleStringT::operator 사용할.

// If the prototype of a function is known to the compiler,
// the PCXSTR cast operator may be invoked implicitly.

CSimpleString strSports(L"Soccer is Best!", pMgr);
WCHAR sz[1024];

wcscpy_s(sz, strSports);

// If the prototype isn't known or is a va_arg prototype,
// you must invoke the cast operator explicitly. For example,
// the va_arg part of a call to swprintf_s() needs the cast:

swprintf_s(sz, 1024, L"I think that %s!\n", (PCWSTR)strSports);

// While the format parameter is known to be an PCXSTR and
// therefore doesn't need the cast:

swprintf_s(sz, 1024, strSports);

// Note that some situations are ambiguous. This line will
// put the address of the strSports object to stdout:

wcout << strSports;

// while this line will put the content of the string out:

wcout << (PCWSTR)strSports;   

요구 사항

헤더: atlsimpstr.h

참고 항목

참조

CSimpleStringT 클래스