Watcom C Library Reference : memccpy, _fmemccpy, memchr, _fmemchr, memcmp, _fmemcmp, memcpy, _fmemcpy, memicmp, _fmemicmp

 

 

 

 

memccpy, _fmemccpy

 

Synopsis : #include <string.h> 

              void *memccpy( void *dest, const void *src, int c, size_t cnt ); 

              void __far *_fmemccpy( void __far *dest, const void __far *src, int c, size_t cnt );


Description : The memccpy and _fmemccpy functions copy bytes from src to dest up to and including the first occurrence of the character c or until cnt bytes have been copied, whichever comes first.


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

 

 

Returns : The memccpy and _fmemccpy functions return a pointer to the byte in dest following the character c if one is found and copied, otherwise it returns NULL.

 

 

See Also : memcpy, memmove, memset

 


Example :

#include <stdio.h> 

#include <string.h>


char *msg = "This is the string: not copied";


void main( )

{
    auto char buffer[80];


    memset( buffer, '\0', 80 );

    memccpy( buffer, msg, ':', 80 );

    printf( "%s\n", buffer );

}

 


produces the following :
This is the string:

 

Classification : WATCOM
Systems : memccpy - All

             _fmemccpy - All

 

 

 

 

 

memchr, _fmemchr

 

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 and _fmemchr functions locate 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 and _fmemchr functions return a pointer to the located character, or NULL if the character does not occur in the object.

 

 

See Also : memcmp, memcpy, memset

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
             _fmemchr - All

 

 

 

 

 

memcmp, _fmemcmp

 

Synopsis : #include <string.h> 

              int mercmp( const void *s1, const void *s2, size_t length ); 

              int _fmemcmp( const void __far *s1, const void __far *s2, size_t length);


Description : The memcmp and _fmemcmp functions compare the first length characters of the object pointed to by s1 to the object pointed to by s2.


The _fmemcmp function is a data model independent form of the memcmp function that accepts far pointer arguments. It is most useful in mixed memory model applications.

 

 

Returns : The memcmp and _fmemcmp functions return an integer less than, equal to, or greater than zero, indicating that the object pointed to by s1 is less than, equal to, or greater than the object pointed to by s2.

 

 

See Also : memchr, memcpy, memicmp, memset

 


Example :

#include <stdio.h> 

#include <string.h>


void main( )

{
    auto char buffer[80];
   

    strcpy( buffer, "world" );

    if( memcmp( buffer, "Hello", 6) < 0 ) {
        printf( "Less than\n" );

    }

}

 

Classification : memcmp is ANSI, _fmemcmp is not ANSI
Systems : memcmp - All 

             _fmemcmp - All

 

 

 

 

 

memcpy, _fmemcpy

 

Synopsis : #include <string.h> 

              void *mercpy( void *dst, const void *src, size_t length );

              void __far *_fmemcpy( void __far *dst, const void __far *src, size_t length );


Description : The memcpy and _fmemcpy functions copy length characters from the buffer pointed to by src into the buffer pointed to by dst. Copying of overlapping objects is not guaranteed to work properly. See the memmove function if you wish to copy objects that overlap.

 

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

 

 

Returns : The original value of dst is returned.

 

 

See Also : memchr, memcmp, memmove, memset

 


Example :

#include <stdio.h> 

#include <string.h>


void main( )

{
    auto char buffer[80];

 

    memcpy( buffer, "Hello", 5);

    buffer[5] = '\0';

    printf( "%s\n", buffer );

}

 

Classification : memcpy is ANSI, _fmemcpy is not ANSI
Systems : memcpy - All 

             _fmemcpy - All

 

 

 

 

 

memicmp, _fmemicmp

 

Synopsis : #include <string.h> 

              int memicmp( const void *s1, const void *s2, size_t length );

              int _fmemicmp( const void __far *s1, const void __far *s2, size_t length );

 


Description : The memicmp and _fmemicmp functions compare, with case insensitivity (upper- and lowercase characters are equivalent), the first length characters of the object pointed to by s1 to the object pointed to by s2.

 

The _fmemicmp function is a data model independent form of the memicmp function that accepts far pointer arguments. It is most useful in mixed memory model applications.

 

 

Returns : The memicmp and _fmemicmp functions return an integer less than, equal to, or greater than zero, indicating that the object pointed to by s1 is less than, equal to, or greater than the object pointed to by s2.

 

 

See Also : memchr, memcmp, memcpy, memset

 


Example :

#include <stdio.h> 

#include <string.h>


void main( )

{
    char buffer[80];
 

    if( memicmp( buffer, "Hello", 5 ) < 0 ) {
        printf( "Less than\n" );

    }

}

 

Classification : WATCOM
Systems : memicmp - All 

             _fmemicmp - All

 

 

 

 

 

 

 

 

 

This manual describes the WATCOM C library for DOS, Windows, and OS/2, It includes the Standard C Library (as defined in the ANSI C Standard).

 

WATCOM C Language Reference manual describes the ANSI C Programming language and extensions to it which are supported by WATCOM C/C++ (32bit)

 

 

 

 

728x90
반응형
Posted by 전화카드
,