[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


strcpy

Copy one character array to another.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <string.h>
char *strcpy(char  *dest, const char *source);
Parameters:

Parameters for this facility are:

dest  
char *  
The destination string  
source  
const char *  
The string being copied  

Remarks:

The strcpy() function copies the character array pointed to by source to the character array pointed to dest. The source argument must point to a null terminated character array. The resulting character array at dest is null terminated as well.

If the arrays pointed to by dest and source overlap, the operation of strcpy() is undefined.

Return:

strcpy() returns the value of dest.

See Also:

"memcpy"

"memmove"

"strncpy"

Example of strcpy() usage.:
#include <string.h>
#include <stdio.h>

int main(void)
{
	char d[30] = "";
	static char s[] = "Metrowerks";
	
	printf(" s=%s\n d=%s\n", s, d);
	strcpy(d, s);
	printf(" s=%s\n d=%s\n", s, d);

	return 0;
}

Output:
 s=Metrowerks
 d=
 s=Metrowerks
 d=Metrowerks


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000