RAD Studio |  |

strcpy

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

Copy Code

    #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 |  | + | + | +

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!