| |||
| Home > RealView Debugger Predefined Macros > Alphabetical predefined macro reference > strcpy | |||
Copies a source string into a destination string.
char *strcpy (dest, src) char *dest; char *src;
where:
destA character pointer, that specifies the starting
address for the destination character string. Characters from the src string
are copied to the dest string location.
srcA
character pointer that specifies the starting address for the source
character string. This string is copied to the dest character
string address.
This macro writes the src string directly
to the dest string address beginning at the first
byte pointed to by dest. It writes until encountering
a NUL character '\0', which
designates the end of the src string. It returns
a pointer to the dest string.
This macro behaves like the strcpy function
in the ANSI C string library.
If the destination string is a debugger array, the macro checks
the size of the array before copying. Otherwise this macro does
not check to see whether the second string can fit in the first array.
Failure to allocate enough space for the first array causes excess
characters to overflow into adjacent memory locations. Consider
using the strlen macro first to confirm that
there is enough length in dest, for the src string.
This example shows how to use strcpy on
the command line:
add char buff[50] ce strcpy(buff,"source string") printf "%s\n",buff