strcpy, wcscpy, _mbscpy
Go Up to string.h Index
Note: This feature is available only for the classic bcc32 compiler, not for the modern Clang-enhanced compiler.
Header File
string.h, wchar.h, mbstring.h
Category
Memory and String Manipulation Routines, Inline Routines
Prototype
char *strcpy(char *dest, const char *src);
wchar_t *wcscpy(wchar_t *dest, const wchar_t *src);
unsigned char *_mbscpy(unsigned char *dest, const unsigned char *src);
Description
Copies one string into another.
Copies string src to dest, stopping after the terminating null character has been moved.
Return Value
strcpy returns dest.
Example
#include <stdio.h> #include <string.h> int main(void) { char string[10]; char *str1 = "abcdefghi"; strcpy(string, str1); printf("%s\n", string); return 0; }
Portability
POSIX | Win32 | ANSI C | ANSI C++ | |
---|---|---|---|---|
strcpy |
+ |
+ |
+ |
+ |
_mbscpy |
+ |
|||
wcscpy |
+ |
+ |
+ |