Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Use the following tips:
Point to lead bytes, not trail bytes. It is usually unsafe to have a pointer to a trail byte. It is usually safer to scan a string forward rather than in reverse.
There are pointer increment/decrement functions and macros available that move over a whole character:
sz1++;becomes:
sz1 = _mbsinc( sz1 );The
_mbsincand_mbsdecfunctions correctly increment and decrement incharacterunits, regardless of the character size.For decrements, you need a pointer to the head of the string, as in the following:
sz2--;becomes:
sz2 = _mbsdec( sz2Head, sz2 );Alternatively, your head pointer could be to a valid character in the string, such that:
sz2Head < sz2You must have a pointer to a known valid lead byte.
You might want to maintain a pointer to the previous character for faster calls to
_mbsdec.