[Previous] [Contents] [Next]

bcopy()

Copy a number of characters in one string to another

Synopsis:

#include <strings.h>

void bcopy( const void *src,
            void *dst,
            size_t n );

Library:

libc

Description:

The bcopy() function copies the byte string pointed to by src (including any NUL characters) into the array pointed to by dst. The number of bytes to copy is specified by n. Copying of overlapping objects is guaranteed to work properly.


Note: This function is similar to the ANSI memmove() function, but the order of arguments is different. New code should use the ANSI function.

Examples:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int main( void )
  {
    auto char buffer[80];

    bcopy( "Hello ", buffer, 6 );
    bcopy( "world",  &buffer[6], 6 );
    printf( "%s\n", buffer );
    return EXIT_SUCCESS;
  }

produces the output:

Hello world

Classification:

Standard Unix

Safety:
Cancellation point No
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

bcmp(), bzero(), memmove(), strcpy()


[Previous] [Contents] [Next]