Copy part of a string.
char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);
strncpyfunction copies not more than n bytes from the array pointed to by
s2to the array pointed to by
s1. If the array pointed to by
s2is a string that is shorter than n bytes, null bytes are appended to the copy in the array pointed to by
nbytes are written. The function will always return
- The function is only available as fastcall function, so it may only be used in presence of a prototype. If there is no null byte in the first
nbytes of the array pointed to by
s2, the result is not null-terminated.
- If copying takes place between objects that overlap, the behaviour is undefined.
- See also
strcat, strcpy, strncat
#include <string.h> static char hello; strcpy (hello, "Hello world!\n", sizeof (hello) - 1); hello = '\0';