3.2.32. strcat

Concatenates two strings.

Syntax

char *strcat (dest, src)
char *dest;
char *src;

where:

dest

A character pointer, that specifies the starting address for the destination memory area. Characters from the src string are appended to the end of this string, starting where the NUL character previously terminated the string.

src

A character pointer that specifies the starting address for the source memory area, to begin copying characters from, when appending to the end of the *dest string.

Description

This macro appends the src string to the end of the dest string, and then returns a pointer to the dest string. This macro behaves like the strcat function in the ANSI C string library.

Return value

char *

A pointer to the first byte in the dest string.

Rules

This macro does not check to see whether the second string can fit in the first array, unless it is a debugger array. Failure to allot 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 original dest and src together.

Example

This example shows how to use strcat on the command line:

> add char buff[15]
> ce strcpy(buff,"12345")
  Result is: local address 0x10000
> ce strcat(buff,"67890")
  Result is: local address 0x10000
> printf "%s\n",buff
1234567890

See Also

Copyright © 2002-2009 ARM Limited. All rights reserved.ARM DUI 0175K
Non-Confidential