Copies a null-terminated string.
#include <string.h> char *strcpy(char *string1, const char *string2);
errno_t strcpy_s(char *string1, rsize_t s1max, const char *string2);
#include <wchar.h>
wchar_t *wcscpy(wchar_t *string1, const wchar_t *string2);
errno_t wcscpy_s(wchar_t *string1, size_t s1max, const wchar_t *string2);
string1 
s1max 
string2 
No overflow checking is performed in strcpy when strings are copied.
The strcpy_s function copies the string pointed to by string2 (including the terminating null character) into the array pointed to by string1.
The strcpy_s function is subject to contraints:
If there is a runtime-constraint violation, then if string1 is not a null pointer and s1max is greater than zero and not greater than RSIZE_MAX, then strcpy_s sets string1[0] to the null character.
wcscpy and wcscpy_s are wide-character versions of strcpy and strcpy_s respectively.
The strcpy function returns string1.
The strcpy_s function returns 0 on successful completion, or else a non-zero value.
tchar.h routine | 
_UNICODE not defined | 
_UNICODE defined | 
|---|---|---|
| _tcscpy | strcpy | _wcscpy | 
| _tcscpy_s | strcpy_s | _wcscpy_s | 
| Versions | Defined in | Include | Link to | 
|---|---|---|---|
| INtime 3.0 INtime 4.2 (strcpy_s) INtime 6.0 (for wide-character and generic text versions)  | 
intime/rt/include/string.h intime/rt/include/wchar.h intime/rt/include/tchar.h  | 
string.h wchar.h tchar.h  | 
clib.lib |