如何获取char a const * TCHAR指针指向的

时间:2010-07-16 13:08:46

标签: 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 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
}

那么,我怎么能摆脱这个空间呢?

1 个答案:

答案 0 :(得分:5)

如果我正确理解了这个问题:

if (*pPointer == _T(' '))
    ++pPointer;

_T宏确保结果始终为TCHAR类型,TCHAR定义为char(ANSI)或wchar_t(Unicode )。