C++ 如何获取const*TCHAR指针指向的字符
我的指针有些问题C++ 如何获取const*TCHAR指针指向的字符,c++,c,pointers,C++,C,Pointers,我的指针有些问题 void getPartOfString(const TCHAR * wholeString) { const TCHAR * pPointer = NULL; pPointer = _tcsstr(wholeString, searchedString); //searching for a special string in string pPointer += _tcslen(searchedString); //set pointer to th
void getPartOfString(const TCHAR * wholeString)
{
const TCHAR * pPointer = NULL;
pPointer = _tcsstr(wholeString, searchedString); //searching for a special string in string
pPointer += _tcslen(searchedString); //set pointer to the beginning of the string wanted
//here I want to check if the char, the pointer points to is a space and if it is set it forward
}
那么,我怎样才能摆脱这个空间呢?如果我正确理解了这个问题:
if (*pPointer == _T(' '))
++pPointer;
\u T
宏确保结果总是类型为TCHAR
,无论TCHAR
定义为char
(ANSI)还是wchar\u T
(Unicode)。如果我正确理解了问题:
if (*pPointer == _T(' '))
++pPointer;
无论
TCHAR
定义为char
(ANSI)还是wchar
(Unicode),宏\u T
确保结果始终为TCHAR
类型.@Stefenie:对stackoverflow上的正确答案表示感谢的惯常方式是将该答案标记为已接受。@Stefenie:对stackoverflow上的正确答案表示感谢的惯常方式是将该答案标记为已接受。