view docs/ccguide/strcat.refentry @ 2437:d26e96c40194

rfm changes
author aaronwolfe
date Wed, 24 Feb 2010 00:37:08 +0000
parents 32f33a35f57a
children
line wrap: on
line source

<refentry id="strcat">
<refnamediv>
<refname>Strcat</refname>
<refname>Strncat</refname>
<refname>Strcmp</refname>
<refname>Strncmp</refname>
<refname>Strcpy</refname>
<refname>Strhcpy</refname>
<refname>Strncpy</refname>
<refname>Strlen</refname>
<refname>Index</refname>
<refname>Rindex</refname>
<refpurpose>string functions</refpurpose>
</refnamediv>

<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
  <funcdef>char *<function>strcat</function></funcdef>
  <paramdef>char *<parameter>s1</parameter></paramdef>
  <paramdef>char *<parameter>s2</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef>char *<function>strncat</function></funcdef>
  <paramdef>char *<parameter>s1</parameter></paramdef>
  <paramdef>char *<parameter>s2</parameter></paramdef>
  <paramdef>int <parameter>n</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef>int <function>strcmp</function></funcdef>
  <paramdef>char *<parameter>s1</parameter></paramdef>
  <paramdef>char *<parameter>s2</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef>char *<function>strhcpy</function></funcdef>
  <paramdef>char *<parameter>s1</parameter></paramdef>
  <paramdef>char *<parameter>s2</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef>int <function>strncmp</function></funcdef>
  <paramdef>char *<parameter>s1</parameter></paramdef>
  <paramdef>char *<parameter>s2</parameter></paramdef>
  <paramdef>int <parameter>n</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef>char *<function>strcpy</function></funcdef>
  <paramdef>char *<parameter>s1</parameter></paramdef>
  <paramdef>char *<parameter>s2</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef>char *<function>strncpy</function></funcdef>
  <paramdef>char *<parameter>s1</parameter></paramdef>
  <paramdef>char *<parameter>s2</parameter></paramdef>
  <paramdef>int <parameter>n</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef>int <function>strlen</function></funcdef>
  <paramdef>char *<parameter>s</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef>char *<function>index</function></funcdef>
  <paramdef>char *<parameter>s</parameter></paramdef>
  <paramdef>char <parameter>ch</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef>char *<function>rindex</function></funcdef>
  <paramdef>char *<parameter>s</parameter></paramdef>
  <paramdef>char<parameter>ch</parameter></paramdef>
</funcprototype>
</funcsynopsis>

</refsynopsisdiv>

<refsect1><title>Description</title>
<para>
All strings passed to these functions are assumed null-terminated.
</para>
<para>
Strcat appends a copy of the string pointed to by "s2" to the
end of the string pointed to by "s1". Strncat copies at most
"n" characters. Both return the first argument.
</para>
<para>
Strcmp compares strings "s1" and "s2" for lexicographic order
and returns an integer less than, equal to or greater than 0
where, respectively, "s1" is less than, equal to or greater
than "s2". Strncmp compares at most "n" characters.
</para>
<para>
Strcpy copies characters from "s2" to the space pointed to by
"s1" up to and including the null byte. Strncpy copies exactly
"n" characters. If the string "s2" is too short, the "s1" will
be padded with null bytes to make up the difference. If "s2"
is too long, "s1" may not be null-terminated. Both functions
return the first argument.
</para>
<para>
Strhcpy copies string with sign bit terminator.
</para>
<para>
Strlen returns the number of non-null characters in "s".
</para>
<para>
Index returns a pointer to the first occurrence of "ch" in "s"
or NULL if not found.
</para>
<para>
Rindex returns a pointer to the last occurrence of "ch" in "s"
or NULL if not found.
</para>
</refsect1>
<refsect1><title>Caveats</title>
<para>
Strcat and strcpy have no means of checking that the space
provided is large enough. It is the user's responsibility to
ensure that string space does not overflow.
</para>
</refsect1>
<refsect1><title>See Also</title>
<para>
<link linkend="findstr">findstr()</link>.
</para>
</refsect1>
</refentry>