Internationalization and localization tools


Locale-Sensitive Length Functions

void *memchr(const void *block, int c, size_t size);

wchar_t *wmemchr(const wchar_t *block, wchar_t wc, size_t size);

Internationalization (I18n) Function Overview

The memchr function finds the first occurrence of the byte c (converted to an unsigned char) in the initial size bytes of the object beginning at block. The return value is a pointer to the located byte, or a null pointer if no match was found.

wmemchr is the wide version of the function; its parameters and return value are wide character strings and size is the number of wide characters, not bytes, to be searched.

I18n Issues

Care must be taken with the size parameter. For example, when transitioning from a singlebyte to a multibyte environment, make sure you are passing the number of bytes rather than the number of characters for the size parameter of memchr.

Conversely, when transitioning from a singlebyte to a Windows Unicode environment, make sure you are passing the number of characters rather than the number of bytes for the size parameter of wmemchr.

There is no Windows Generic function for memchr.

Recommended Replacements*

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

Locale-Sensitive Length Functions

 

Lingoport internationalization and localization services and software