##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Standard library header <cstring>

From cppreference.com
< cpp‎ | header

This header was originally in the C standard library as `<string.h>`.

This header is for C-style null-terminated byte strings.

### [edit] Macros

NULL | implementation-defined null pointer constant (macro constant) [edit]

### [edit] Types

size_t | unsigned integer type returned by the `sizeof` operator (typedef) [edit]

### [edit] Functions

##### String manipulation
strcpy | copies one string to another (function) [edit]
strncpy | copies a certain amount of characters from one string to another (function) [edit]
strcat | concatenates two strings (function) [edit]
strncat | concatenates a certain amount of characters of two strings (function) [edit]
strxfrm | transform a string so that strcmp would produce the same result as strcoll (function) [edit]
##### String examination
strlen | returns the length of a given string (function) [edit]
strcmp | compares two strings (function) [edit]
strncmp | compares a certain amount of characters of two strings (function) [edit]
strcoll | compares two strings in accordance to the current locale (function) [edit]
strchr | finds the first occurrence of a character (function) [edit]
strrchr | finds the last occurrence of a character (function) [edit]
strspn | returns the length of the maximum initial segment that consists of only the characters found in another byte string (function) [edit]
strcspn | returns the length of the maximum initial segment that consists of only the characters not found in another byte string (function) [edit]
strpbrk | finds the first location of any character from a set of separators (function) [edit]
strstr | finds the first occurrence of a substring of characters (function) [edit]
strtok | finds the next token in a byte string (function) [edit]
##### Character array manipulation
memchr | searches an array for the first occurrence of a character (function) [edit]
memcmp | compares two buffers (function) [edit]
memset | fills a buffer with a character (function) [edit]
memcpy | copies one buffer to another (function) [edit]
memmove | moves one buffer to another (function) [edit]
##### Miscellaneous
strerror | returns a text version of a given error code (function) [edit]

### [edit] Notes

- NULL is also defined in the following headers:
  - `<clocale>`
  - `<ctime>`
  - `<cstddef>`
  - `<cstdio>`
  - `<cwchar>`
- std::size_t is also defined in the following headers:
  - `<ctime>`
  - `<cstddef>`
  - `<cstdio>`
  - `<cwchar>`

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/header/cstring&oldid=57467"