strcpy, _fstrcpy

Description

Copy a string.

#include <string.h> Required only for function declarations  

char *strcpy( char *string1, const char *string2 );

char __far * __far _fstrcpy( char __far *string1, const char __far *string2 );

string1 Destination string  
string2 Source string  

Remarks

The strcpy function copies string2, including the terminating null character, to the location specified by string1, and returns string1.

The strcpy and _fstrcpy functions operate on null-terminated strings. The string arguments to these functions are expected to contain a null character ('\0') marking the end of the string. No overflow checking is performed when strings are copied or appended.

The _fstrcpy function is a model-independent (large-model) form of the strcpy function. The behavior and return value of _fstrcpy are identical to those of the model-dependent function strcpy, with the exception that the arguments and return values are far pointers.

Return Value

The return values for these functions are described above.

Compatibility

strcpy

Standards:ANSI, UNIX

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:DOS32X

_fstrcpy

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:None

See Also

strcat, strcmp, strncat, strncmp, strncpy, _strnicmp, strrchr, strspn

Example

/* STRCPY.C: This program uses strcpy and strcat to build a phrase. */

#include <string.h>

#include <stdio.h>

void main( void )

{

char string[80];

strcpy( string, "Hello world from " );

strcat( string, "strcpy " );

strcat( string, "and " );

strcat( string, "strcat!" );

printf( "String = %s\n", string );

}

Output

String = Hello world from strcpy and strcat!