: Hello everybody,
: can anyone help me? :S
:
: how can I get only one character from
: WCHAR *str = L"string";
: for example only "r", when I'm typing this
: MessageBox(NULL,&str[3],NULL,NULL);
: it gets "ring" and not "r"
:
: please help me ...
:
Since message box function takes a string as parameter - you need to CREATE a second string with only one character - one you need. Also, character indexes begin with 0, so 'r' will be addressed as str[2] and not str[3].
WCHAR *str = L"string";
WCHAR buf [2]; // New string with room for ONLY one character
...
buf [0] = str [2]; // Move 'r' as first character of new string
buf [1] = 0; // Terminate new string with null as C lang. needs
MessageBox (0, buf, 0, 0); // Now you will see only one character