Anzeigen: Delphi
C++
Anzeigeeinstellungen
memcpy, _wmemcpy
Aus RAD Studio XE2
Nach oben zu mem.h - Index
Header-Datei
mem.h, string.h
Kategorie
Routinen für Speicher- und String-Bearbeitung, Inline-Routinen
Prototyp
void *memcpy(void *dest, const void *src, size_t n);
void *_wmemcpy(void *dest, const void *src, size_t n);
Beschreibung
Kopiert einen Block von n Bytes.
memcpy ist auf UNIX System V-Systemen verfügbar.
memcpy kopiert einen Block von n Bytes von src nach dest. Wenn sich src und dest überlappen, ist das Verhalten von memcpy nicht definiert.
Rückgabewert
memcpy gibt dest zurück.
Beispiel
#include <stdio.h> #include <string.h> int main(void) { char src[] = "******************************"; char dest[] = "abcdefghijlkmnopqrstuvwxyz0123456709"; char *ptr; printf("destination before memcpy: %s\n", dest); ptr = (char *) memcpy(dest, src, strlen(src)); if (ptr) printf("destination after memcpy: %s\n", dest); else printf("memcpy failed\n"); return 0; }
Portabilität
| POSIX | Win32 | ANSI C | ANSI C++ | |
|---|---|---|---|---|
|
memcpy |
+ |
+ |
+ |
+ |
|
_wmemcpy |
+ |