2010-07-16 5 views
0

J'ai quelques problèmes avec un pointeurComment obtenir le char a const * points de pointeur TCHAR à

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 
} 

Alors, comment puis-je me débarrasser de cet espace?

Répondre

4

Si je comprends bien la question:

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

La macro _T assure que le résultat est toujours de type TCHAR, si TCHAR est défini comme char (ANSI) ou wchar_t (Unicode).

+0

OMG, merci. Je n'ai jamais pensé que ça pourrait être aussi facile ... – Stefanie

+0

@Stefenie: La façon habituelle de remercier quelqu'un pour une réponse correcte sur stackoverflow est de marquer cette réponse comme acceptée. – Johnsyweb

Questions connexes