繁体   English   中英

如何获取Char const * TCHAR指针指向

[英]How to get the Char a const * TCHAR pointer points to

指针出现问题

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)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM