指针出现问题
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;
_T
宏可确保结果始终为TCHAR
类型,无论TCHAR
是定义为char
(ANSI)还是wchar_t
(Unicode)。关于c++ - 如何获取一个const * TCHAR指针指向的Char,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3265107/