Str_Copy()
Copies string character values from one string memory buffer to another memory buffer.
Files
lib_str.h/lib_str.c
Prototype
CPU_CHAR *Str_Copy ( CPU_CHAR *pstr_dest, const CPU_CHAR *pstr_src);
Arguments
pstr_dest
Pointer to the string memory buffer to copy string characters into.
pstr_src
Pointer to the string memory buffer to copy string characters from.
Returned Value
Pointer to copied destination string, if no errors;
Pointer to NULL
, otherwise.
Required Configuration
None.
Notes / Warnings
Destination buffer size (pstr_dest
) is not validated; buffer overruns must be prevented by caller. Destination buffer size must be large enough to accomodate the entire source string size including its terminating NULL
character.
String copy terminates if either string pointer points to or overlaps the NULL
address.
Example Usage
CPU_CHAR AppBuf[20]; CPU_CHAR *pstr; pstr = Str_Copy(&AppBuf[0], "Hello World!"); if (pstr == (CPU_CHAR *)0) { printf("STRING COPY FAILED!"); }