簡體   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