Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>memcpy() copy characters between buffers</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 memcpy()                Copy Characters between Buffers

 #include   <memory.h>                   Required for declarations only
 #include   <string.h>                   Use either string.h or memory.h

 void       *memcpy(dest,source,cnt);
 void       *dest;                       Pointer to destination
 const void *source;                     Pointer to source
 size_t cnt;                             Number of characters

 memcpy() copies 'cnt' characters from 'source' to 'dest'.  If part of 'dest'
 and 'source' overlap, memcpy() should not be used. It does not ensure that
 the original 'source' bytes will not be overwritten.  Use memmove() to
 ensure that nothing gets overwritten.

    Returns:    A pointer to 'dest'.

 Compatibility: MSC version 4.0 did ensure that overlapping regions were
                copied before being over-written by memcpy().

   -------------------------------- Example ---------------------------------

    The following statement copies 100 characters from 'from_buffer' to
    'to_buffer'.

           #include <memory.h>

           char to_buffer[100];
           char from_buffer[100] = "HI THERE!";

           main()
           {
               memcpy(to_buffer,from_buffer,100);
               printf("%s\n",to_buffer);
           }



See Also: memccpy() memchr() memcmp() memset()

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