2.1.2.50 strcpy


Description

Copy a string.

Syntax

LPSTR strcpy( LPSTR lpszDestination, LPCSTR lpcszSource )

Parameters

lpszDestination
[modify] Pointer to a buffer into which the function copies characters. The buffer must be large enough to contain all the characters from lpcszSource, including room for a terminating null character.
lpcszSource
[input] Pointer to a null-terminated string from which the function copies characters.

Return

If the function succeeds, the return value is a pointer to the buffer. If the function fails, the return value is NULL.

Examples

EX1

void strcpy_ex1()
{
    string        str = "Hello World!";
    char        szStr[80];
    strcpy(szStr, str);
    out_str(szStr);    // Should be "Hello World!"
}

Remark

See Also

strncpy

Header to Include

origin.h

Reference