Namespaces
Variants

Standard library header <string.h>

From cppreference.net

Cet en-tête fournit des fonctions pour manipuler les chaînes d'octets terminées par un caractère nul .

Table des matières

Macros

constante de pointeur nul définie par l'implémentation
(constante macro)

Types

type entier non signé renvoyé par l'opérateur sizeof
(typedef)

Fonctions

Manipulation de chaînes
copie une chaîne de caractères vers une autre
(fonction)
copie un certain nombre de caractères d'une chaîne à une autre
(fonction)
concatène deux chaînes de caractères
(fonction)
concatène un certain nombre de caractères de deux chaînes
(fonction)
transforme une chaîne de caractères de sorte que strcmp produise le même résultat que strcoll
(fonction)
(C23)
alloue une copie d'une chaîne de caractères
(fonction)
(C23)
alloue une copie d'une chaîne de taille spécifiée
(fonction)
Examen de chaîne
renvoie la longueur d'une chaîne donnée
(fonction)
compare deux chaînes de caractères
(fonction)
compare un certain nombre de caractères de deux chaînes
(fonction)
compare deux chaînes de caractères selon la locale actuelle
(fonction)
trouve la première occurrence d'un caractère
(fonction)
trouve la dernière occurrence d'un caractère
(fonction)
retourne la longueur du segment initial maximum qui consiste
uniquement en des caractères trouvés dans une autre chaîne d'octets
(fonction)
retourne la longueur du segment initial maximal qui consiste
uniquement en caractères non trouvés dans une autre chaîne d'octets
(fonction)
trouve la première occurrence de n'importe quel caractère d'une chaîne dans une autre chaîne
(fonction)
trouve la première occurrence d'une sous-chaîne de caractères
(fonction)
trouve le jeton suivant dans une chaîne d'octets
(fonction)
Manipulation de tableaux de caractères
recherche dans un tableau la première occurrence d'un caractère
(fonction)
compare deux tampons
(fonction)
remplit un tampon avec un caractère
(fonction)
copie un tampon vers un autre
(fonction)
déplace un tampon vers un autre
(fonction)
(C23)
copie un tampon vers un autre, en s'arrêtant après le délimiteur spécifié
(fonction)
Divers
retourne une version textuelle d'un code d'erreur donné
(fonction)

Synopsis

#define __STDC_VERSION_STRING_H__ 202311L
#define NULL /* voir description */
typedef /* voir description */ size_t;
void* memcpy(void* restrict s1, const void* restrict s2, size_t n);
void* memccpy(void* restrict s1, const void* restrict s2, int c, size_t n);
void* memmove(void* s1, const void* s2, size_t n);
char* strcpy(char* restrict s1, const char* restrict s2);
char* strncpy(char* restrict s1, const char* restrict s2, size_t n);
char* strdup(const char* s);
char* strndup(const char* s, size_t n);
char* strcat(char* restrict s1, const char* restrict s2);
char* strncat(char* restrict s1, const char* restrict s2, size_t n);
int memcmp(const void* s1, const void* s2, size_t n);
int strcmp(const char* s1, const char* s2);
int strcoll(const char* s1, const char* s2);
int strncmp(const char* s1, const char* s2, size_t n);
size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n);
/*QVoid*/* memchr(/*QVoid*/* s, int c, size_t n);
/*QChar*/* strchr(/*QChar*/* s, int c);
size_t strcspn(const char* s1, const char* s2);
/*QChar*/* strpbrk(/*QChar*/* s1, const char* s2);
/*QChar*/* strrchr(/*QChar*/* s, int c);
size_t strspn(const char* s1, const char* s2);
/*QChar*/* strstr(/*QChar*/* s1, const char* s2);
char* strtok(char* restrict s1, const char* restrict s2);
void* memset(void* s, int c, size_t n);
void* memset_explicit(void* s, int c, size_t n);
char* strerror(int errnum);
size_t strlen(const char* s);
size_t strnlen(const char* s, size_t n);

Seulement si l'implémentation définit __STDC_LIB_EXT1__ et que le code utilisateur définit également __STDC_WANT_LIB_EXT1__ avant toute inclusion de <string.h> :

#ifdef __STDC_WANT_LIB_EXT1__
tyepdef /* voir description */ errno_t;
tyepdef /* voir description */ rsize_t;
errno_t memcpy_s(void* restrict s1, rsize_t s1max, const void* restrict s2, rsize_t n);
errno_t memmove_s(void* s1, rsize_t s1max, const void* s2, rsize_t n);
errno_t strcpy_s(char* restrict s1, rsize_t s1max, const char* restrict s2);
errno_t strncpy_s(char* restrict s1, rsize_t s1max, const char* restrict s2, rsize_t n);
errno_t strcat_s(char* restrict s1, rsize_t s1max, const char* restrict s2);
errno_t strncat_s(char* restrict s1, rsize_t s1max, const char* restrict s2, rsize_t n);
char* strtok_s(char* restrict s1, rsize_t* restrict s1max,
               const char* restrict s2, char** restrict ptr);
errno_t memset_s(void* s, rsize_t smax, int c, rsize_t n)
errno_t strerror_s(char* s, rsize_t maxsize, errno_t errnum);
size_t strerrorlen_s(errno_t errnum);
size_t strnlen_s(const char* s, size_t maxsize);
#endif