466
|
1 <refentry id="strcat">
|
|
2 <refnamediv>
|
529
|
3 <refname>Strcat</refname>
|
|
4 <refname>Strncat</refname>
|
|
5 <refname>Strcmp</refname>
|
|
6 <refname>Strncmp</refname>
|
|
7 <refname>Strcpy</refname>
|
|
8 <refname>Strhcpy</refname>
|
|
9 <refname>Strncpy</refname>
|
|
10 <refname>Strlen</refname>
|
|
11 <refname>Index</refname>
|
|
12 <refname>Rindex</refname>
|
|
13 <refpurpose>string functions</refpurpose>
|
466
|
14 </refnamediv>
|
|
15
|
|
16 <refsynopsisdiv>
|
|
17 <funcsynopsis>
|
|
18 <funcprototype>
|
529
|
19 <funcdef>char *<function>strcat</function></funcdef>
|
|
20 <paramdef>char *<parameter>s1</parameter></paramdef>
|
|
21 <paramdef>char *<parameter>s2</parameter></paramdef>
|
|
22 </funcprototype>
|
|
23
|
|
24 <funcprototype>
|
|
25 <funcdef>char *<function>strncat</function></funcdef>
|
|
26 <paramdef>char *<parameter>s1</parameter></paramdef>
|
|
27 <paramdef>char *<parameter>s2</parameter></paramdef>
|
|
28 <paramdef>int <parameter>n</parameter></paramdef>
|
|
29 </funcprototype>
|
|
30
|
|
31 <funcprototype>
|
|
32 <funcdef>int <function>strcmp</function></funcdef>
|
|
33 <paramdef>char *<parameter>s1</parameter></paramdef>
|
|
34 <paramdef>char *<parameter>s2</parameter></paramdef>
|
|
35 </funcprototype>
|
|
36
|
|
37 <funcprototype>
|
|
38 <funcdef>char *<function>strhcpy</function></funcdef>
|
|
39 <paramdef>char *<parameter>s1</parameter></paramdef>
|
|
40 <paramdef>char *<parameter>s2</parameter></paramdef>
|
|
41 </funcprototype>
|
|
42
|
|
43 <funcprototype>
|
|
44 <funcdef>int <function>strncmp</function></funcdef>
|
|
45 <paramdef>char *<parameter>s1</parameter></paramdef>
|
|
46 <paramdef>char *<parameter>s2</parameter></paramdef>
|
|
47 <paramdef>int <parameter>n</parameter></paramdef>
|
|
48 </funcprototype>
|
|
49
|
|
50 <funcprototype>
|
|
51 <funcdef>char *<function>strcpy</function></funcdef>
|
|
52 <paramdef>char *<parameter>s1</parameter></paramdef>
|
|
53 <paramdef>char *<parameter>s2</parameter></paramdef>
|
|
54 </funcprototype>
|
|
55
|
|
56 <funcprototype>
|
|
57 <funcdef>char *<function>strncpy</function></funcdef>
|
|
58 <paramdef>char *<parameter>s1</parameter></paramdef>
|
|
59 <paramdef>char *<parameter>s2</parameter></paramdef>
|
|
60 <paramdef>int <parameter>n</parameter></paramdef>
|
|
61 </funcprototype>
|
|
62
|
|
63 <funcprototype>
|
|
64 <funcdef>int <function>strlen</function></funcdef>
|
|
65 <paramdef>char *<parameter>s</parameter></paramdef>
|
|
66 </funcprototype>
|
|
67
|
|
68 <funcprototype>
|
|
69 <funcdef>char *<function>index</function></funcdef>
|
|
70 <paramdef>char *<parameter>s</parameter></paramdef>
|
|
71 <paramdef>char <parameter>ch</parameter></paramdef>
|
|
72 </funcprototype>
|
|
73
|
|
74 <funcprototype>
|
|
75 <funcdef>char *<function>rindex</function></funcdef>
|
|
76 <paramdef>char *<parameter>s</parameter></paramdef>
|
|
77 <paramdef>char<parameter>ch</parameter></paramdef>
|
466
|
78 </funcprototype>
|
|
79 </funcsynopsis>
|
|
80
|
|
81 </refsynopsisdiv>
|
|
82
|
|
83 <refsect1><title>Description</title>
|
|
84 <para>
|
529
|
85 All strings passed to these functions are assumed null-terminated.
|
|
86 </para>
|
|
87 <para>
|
|
88 Strcat appends a copy of the string pointed to by "s2" to the
|
|
89 end of the string pointed to by "s1". Strncat copies at most
|
|
90 "n" characters. Both return the first argument.
|
|
91 </para>
|
|
92 <para>
|
|
93 Strcmp compares strings "s1" and "s2" for lexicographic order
|
|
94 and returns an integer less than, equal to or greater than 0
|
|
95 where, respectively, "s1" is less than, equal to or greater
|
|
96 than "s2". Strncmp compares at most "n" characters.
|
|
97 </para>
|
|
98 <para>
|
|
99 Strcpy copies characters from "s2" to the space pointed to by
|
|
100 "s1" up to and including the null byte. Strncpy copies exactly
|
|
101 "n" characters. If the string "s2" is too short, the "s1" will
|
|
102 be padded with null bytes to make up the difference. If "s2"
|
|
103 is too long, "s1" may not be null-terminated. Both functions
|
|
104 return the first argument.
|
|
105 </para>
|
|
106 <para>
|
|
107 Strhcpy copies string with sign bit terminator.
|
|
108 </para>
|
|
109 <para>
|
|
110 Strlen returns the number of non-null characters in "s".
|
|
111 </para>
|
|
112 <para>
|
|
113 Index returns a pointer to the first occurrence of "ch" in "s"
|
|
114 or NULL if not found.
|
|
115 </para>
|
|
116 <para>
|
|
117 Rindex returns a pointer to the last occurrence of "ch" in "s"
|
|
118 or NULL if not found.
|
|
119 </para>
|
|
120 </refsect1>
|
|
121 <refsect1><title>Caveats</title>
|
|
122 <para>
|
|
123 Strcat and strcpy have no means of checking that the space
|
|
124 provided is large enough. It is the user's responsibility to
|
|
125 ensure that string space does not overflow.
|
|
126 </para>
|
|
127 </refsect1>
|
|
128 <refsect1><title>See Also</title>
|
|
129 <para>
|
545
|
130 <link linkend="findstr">findstr()</link>.
|
466
|
131 </para>
|
|
132 </refsect1>
|
|
133 </refentry>
|