JavaScript EditorDhtml editor     Free javascript download 



Main Page

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:

    В CopyCode imageCopy Code
    sz1++;

    becomes:

    В CopyCode imageCopy Code
    sz1 = _mbsinc( sz1 );

    The _mbsinc and _mbsdec functions correctly increment and decrement in character units, regardless of the character size.

  • For decrements, you need a pointer to the head of the string, as in the following:

    В CopyCode imageCopy Code
    sz2--;

    becomes:

    В CopyCode imageCopy Code
    sz2 = _mbsdec( sz2Head, sz2 );

    Alternatively, your head pointer could be to a valid character in the string, such that:

    В CopyCode imageCopy Code
    sz2Head < sz2

    You 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.

See Also



JavaScript EditorDhtml editor     Free javascript download