annotate docs/ccguide/strcat.refentry @ 1417:b7b173926ea1

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