<< Previous | Next >>

memchr

NEAR SYNTAX: void * _n_memchr( void * src, int ch, unsigned int n );

FAR SYNTAX: void far * _f_memchr( void far * src, int ch, size_t n );

NOTE By default, memchr() is defined to _n_memchr().

Description

Searches up to n characters at memory pointed to by src for character ch.

For Rabbit 4000+ users, this function supports FAR pointers. By default the near version of the function is called. The macro USE_FAR_STRING will change all calls to functions in this library to their far versions. The user may also explicitly call the far version with _f_strfunc where strfunc is the name of the string function.

Because FAR addresses are larger, the far versions of this function will run slightly slower than the near version. To explicitly call the near version when the USE_FAR_STRING macro is defined and all pointers are near pointers, append _n_ to the function name, e.g., _n_strfunc. For more information about FAR pointers, see the Dynamic C User's Manual or the samples in Samples/Rabbit4000/FAR/.

Parameters

src
Pointer to memory source.

ch
Character to search for.

n
Number of bytes to search.

Return value

Pointer to first occurrence of ch if found within n characters. Otherwise returns null.

Library

STRING.LIB

See also

strrchr, strstr


Dynamic C Functions << Previous | Next >> rabbit.com