  | 
≫  | 
 | 
  
 | 
    
      | 
    
    
    
     
HP OpenVMS HP C ランタイム・ライブラリ・リファレンス・マニュアル (下巻)
  
 
  
 
str_1 の末尾に,終端の null 文字を含めて str_2 を連結します。
 
 
形式
#include <string.h>
char *strcat (char *str_1, const char *str_2);
 
  関数バリアント
strcat関数は,それぞれ 32 ビットと 64 ビットのポインタ・サイズで使用するための
_strcat32と
_strcat64という名前のバリアントを持っています。ポインタ・サイズ固有の関数の使用方法については,『HP C ランタイム・ライブラリ・リファレンス・マニュアル(上巻)』第 1.9 節を参照してください。
 
引数
 
 str_1, str_2null で終了する文字列へのポインタ。
 
 
説明
strncatを参照してください。
 
 
戻り値
 
| x
 | 
第 1 引数
str_1 のアドレス。これは連結された結果を保持できるだけの大きさを持つと仮定されます。
 | 
 
 
  
 
例
 
 
#include <string.h> 
#include <stdio.h> 
 
/* This program concatenates two strings using the strcat       */ 
/* function, and then manually compares the result of strcat    */ 
/* to the expected result.                                      */ 
 
#define S1LENGTH 10 
#define S2LENGTH 8 
 
main() 
{ 
    static char s1buf[S1LENGTH + S2LENGTH] = "abcmnexyz"; 
    static char s2buf[] = " orthis"; 
    static char test1[] = "abcmnexyz orthis"; 
 
    int i; 
    char *status; 
 
    /* Take static buffer s1buf, concatenate static buffer      */ 
    /* s2buf to it, and compare the answer in s1buf with the    */ 
    /* static answer in test1.                                  */ 
 
    status = strcat(s1buf, s2buf); 
    for (i = 0; i <= S1LENGTH + S2LENGTH - 2; i++) { 
        /* Check for correct returned string.   */ 
 
        if (test1[i] != s1buf[i]) 
            printf("error in strcat"); 
    } 
}                                         
 |  
 
  
 
 
      |