C Tutorial/string.h/memcpy

Материал из C\C++ эксперт
Версия от 13:32, 25 мая 2010; Admin (обсуждение | вклад) (1 версия: Импорт контента...)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

memcpy

Item Value Header file string.h Declaration void *memcpy(void *to, const void *from, size_t count); Function copies count characters from *from into *to. Return returns *to.


<source lang="cpp">#include <stdio.h>

 #include <string.h>
 #define SIZE 80
 int main(void)
 {
   char buf1[SIZE], buf2[SIZE];
   strcpy(buf1, "When, in the course of...");
   memcpy(buf2, buf1, SIZE);
   printf(buf2);
   return 0;
 }</source>