Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <string.h>
    void *memchr( const void *buf, int ch, size_t length );
    void __far *_fmemchr( const void __far *buf,
                          int ch,
                          size_t length );

Description:
    The memchr function locates the first occurrence of ch (converted to an
    unsigned char) in the first length characters of the object pointed to
    by buf.

    The _fmemchr function is a data model independent form of the memchr
    function.  It accepts far pointer arguments and returns a far pointer.
     It is most useful in mixed memory model applications.

Returns:
    The memchr function returns a pointer to the located character, or NULL
    if the character does not occur in the object.

Example:
    #include <stdio.h>
    #include <string.h>

    void main()
      {
        char buffer[80];
        char *where;

        strcpy( buffer, "video x-rays" );
        where = (char *) memchr( buffer, 'x', 6 );
        if( where == NULL )
          printf( "'x' not found\n" );
        else
          printf( "%s\n", where );
        where = (char *) memchr( buffer, 'r', 9 );
        if( where == NULL )
          printf( "'r' not found\n" );
        else
          printf( "%s\n", where );
      }

Classification:
    memchr is ANSI, _fmemchr is not ANSI

Systems:
     memchr - All, Netware

    _fmemchr - All

See Also:
    memcmp, memcpy, memicmp, memset

See Also:

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson