The <cstring>
header is for the C++ version of the C standard <string.h>
header, which declares
string-handling functions.
The functions in this section fall into two categories, identified by the first three letters of the function name:
mem
. . .The mem
functions operate
on arbitrary chunks of memory, treating the memory as arrays of
unsigned
char
. The caller must specify the size
of each memory chunk.
str
. . .The str
functions operate
on null-terminated character arrays. Even though the function
parameters are declared as type char
, they are always interpreted as
unsigned
char
when comparing two
characters.
See also <cwchar>
for
wide character string functions.
Instead of using C-style, null-terminated character arrays, C++
code should use the string
and
wstring
classes that are declared
in the <string>
header. C++
strings offer high performance, more flexibility, more safety, and
greater ease of use. The char_traits
class template in <string>
also provides member
functions for working with narrow and wide character arrays.