【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.2.27 lstrcpy
Contents
Description
The lstrcpy (alias strcpy) function copies a string to a buffer.
Syntax
LPSTR lstrcpy( LPSTR lpString1, LPCSTR lpString2 )
Parameters
- lpString1
- [modify]Pointer to the destination buffer to receive the contents of the string pointed to by the lpString2 parameter. The buffer must be large enough to contain the string, including the terminating null character.
- lpString2
- [input]Pointer to the null-terminated source string to be copied.
Return
If the function succeeds, the return value is a pointer to the destination buffer. If the function fails,the return value is NULL.
Examples
EX1
void lstrcpy_ex1() { char *ptr = NULL; char szStr[80]; string str1 = "Here is some text"; // Copy str1 to szStr: ptr = lstrcpy(szStr, str1); if(0 == strcmp(ptr, "Here is some text") ) printf(" after copy szStr is \"%s\" \n" , szStr); else printf("copy failed\n"); }
Remark
See Also
Header to Include
origin.h