-

「Functions HI-TECH C STRNCAT」の版間の差分

提供: HI-TECH C for CP/M Fan WIKI(JP)
移動先: 案内検索
(ページの作成:「<strong>STRCAT, STRCMP, STRCPY, STRLEN et. al.</strong> ==概要== #include <string.h> char * strcat(char * s1, char * s2); int strcmp(char * s1, char * s2); c...」)
 
(内容を「STRCATを参照」で置換)
 
1行目: 1行目:
<strong>STRCAT, STRCMP, STRCPY, STRLEN et. al.</strong>
+
[[Functions_HI-TECH_C_STRCAT|STRCAT]]を参照
==概要==
 
 
 
#include  <string.h>
 
 
char *    strcat(char * s1, char * s2);
 
int strcmp(char * s1, char * s2);
 
char *    strcpy(char * s1, char * s2);
 
int strlen(char * s);
 
char *    strncat(char * s1, char * s2, size_t n);
 
int strncmp(char * s1, char * s2, size_t n);
 
char *    strncpy(char * s1, char * s2, size_t n);
 
 
 
 
 
==詳細==
 
これらの関数はnull終端の文字列操作を提供します。<strong>Strcat</strong>()は文字列s2を文字列s1の後に追加します。s1はnull終端になります。言うまでもないですが、s1のバッファは十分に大きい必要があります。<strong>Strcmp</strong>()は二つの文字列を比較し、それぞれ、s1の方が大きい場合、両方が等しい場合、s2よりも小さい場合に、それぞれ0より大きい数、0、0より小さい数を返します。比較は最初の文字がもっとも顕著に、アスキー文字順に照合して行われます。<strong>Strcpy</strong>()はs2をs1のバッファにコピーし、null終端します。<strong>Strncat</strong>()、 <strong>strncmp</strong>()、<strong>strncpy</strong>()は上記の対応した名前のものと同様にして連結、比較、s2からs1へのコピーしますが、最大n文字までを扱います??。<strong>strncpy</strong>()の結果の文字列はnull終端されません??
 

2017年12月13日 (水) 12:10時点における最新版

STRCATを参照