函式
<cstring>

strcat

char * strcat ( char * destination, const char * source );
連線字串
source 字串的副本附加到 destination 字串。 destination 中的終止空字元被 source 的第一個字元覆蓋,並將一個空字元包含在由兩個字串連線而成的新字串末尾,該字串在 destination 中。

destinationsource 不得重疊。

引數

destination
目標陣列的指標,該陣列應包含一個 C 字串,並且足夠大以容納連線後形成的結果字串。
source
要附加的 C 字串。此字串不應與 destination 重疊。

返回值

返回 destination

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* strcat example */
#include <stdio.h>
#include <string.h>

int main ()
{
  char str[80];
  strcpy (str,"these ");
  strcat (str,"strings ");
  strcat (str,"are ");
  strcat (str,"concatenated.");
  puts (str);
  return 0;
}

輸出

these strings are concatenated. 


另見