I thought it would be enough just to use "--ptr" to go back one character in UCS-16 strings. Only MBCS or UTF-8 encoded strings would need such helper functions like CharPrevW()?
IIRC there are these 'surrogate pairs' in which case just --ptr will not work correctly: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/indexsrv/ht...
Thanks for the pointer. I found this web about UTF-16 surrogate pairs page with translation table even more enlighting: http://www.i18nguy.com/unicode/surrogatetable.html#jump
Because I'm only using the routine to search for the last dot character in strings to determine file extensions, there is no problem. The code for '.' is not present in the surrogate code range. So just advancing back in the string using pointer decreasing is enough.
Regards,
Martin