The Open Group Base Specifications Issue 8
IEEE Std 1003.1-2024
Copyright © 2001-2024 The IEEE and The Open Group

NAME

string.h — string operations

SYNOPSIS

#include <string.h>

DESCRIPTION

[CX] [Option Start] Some of the functionality described on this reference page extends the ISO C standard. Applications shall define the appropriate feature test macro (see XSH 2.2 The Compilation Environment) to enable the visibility of these symbols in this header. [Option End]

The <string.h> header shall define NULL and size_t as described in <stddef.h>.

[CX] [Option Start] The <string.h> header shall define the locale_t type as described in <locale.h>. [Option End]

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided for use with ISO C standard compilers.

[XSI][Option Start]
void    *memccpy(void *restrict, const void *restrict, int, size_t);
[Option End]
void    *memchr(const void *, int, size_t);
int      memcmp(const void *, const void *, size_t);
void    *memcpy(void *restrict, const void *restrict, size_t);
[CX][Option Start]
void    *memmem(const void *, size_t, const void *, size_t);
[Option End]
void    *memmove(void *, const void *, size_t);
void    *memset(void *, int, size_t);
[CX][Option Start]
char    *stpcpy(char *restrict, const char *restrict);
char    *stpncpy(char *restrict, const char *restrict, size_t);
[Option End]
char    *strcat(char *restrict, const char *restrict);
char    *strchr(const char *, int);
int      strcmp(const char *, const char *);
int      strcoll(const char *, const char *);
[CX][Option Start]
int      strcoll_l(const char *, const char *, locale_t);
[Option End]
char    *strcpy(char *restrict, const char *restrict);
size_t   strcspn(const char *, const char *);
[CX][Option Start]
char    *strdup(const char *);
[Option End]
char    *strerror(int);
[CX][Option Start]
char    *strerror_l(int, locale_t);
int      strerror_r(int, char *, size_t);
size_t   strlcat(char *restrict, const char *restrict, size_t);
size_t   strlcpy(char *restrict, const char *restrict, size_t);
[Option End]
size_t   strlen(const char *);
char    *strncat(char *restrict, const char *restrict, size_t);
int      strncmp(const char *, const char *, size_t);
char    *strncpy(char *restrict, const char *restrict, size_t);
[CX][Option Start]
char    *strndup(const char *, size_t);
size_t   strnlen(const char *, size_t);
[Option End]
char    *strpbrk(const char *, const char *);
char    *strrchr(const char *, int);
[CX][Option Start]
char    *strsignal(int);
[Option End]
size_t   strspn(const char *, const char *);
char    *strstr(const char *, const char *);
char    *strtok(char *restrict, const char *restrict);
[CX][Option Start]
char    *strtok_r(char *restrict, const char *restrict, char **restrict);
[Option End]
size_t   strxfrm(char *restrict, const char *restrict, size_t);
[CX][Option Start]
size_t   strxfrm_l(char *restrict, const char *restrict,
             size_t, locale_t);
[Option End]

[CX] [Option Start] Inclusion of the <string.h> header may also make visible all symbols from <stddef.h>. [Option End]


The following sections are informative.

APPLICATION USAGE

None.

RATIONALE

None.

FUTURE DIRECTIONS

None.

SEE ALSO

<locale.h>, <stddef.h>, <sys/types.h>

XSH 2.2 The Compilation Environment, memccpy, memchr, memcmp, memcpy, memmem, memmove, memset, strcat, strchr, strcmp, strcoll, strcpy, strcspn, strdup, strerror, strlcat, strlen, strncat, strncmp, strncpy, strpbrk, strrchr, strsignal, strspn, strstr, strtok, strxfrm

CHANGE HISTORY

First released in Issue 1. Derived from Issue 1 of the SVID.

Issue 5

The DESCRIPTION is updated for alignment with the POSIX Threads Extension.

Issue 6

The strtok_r() function is marked as part of the Thread-Safe Functions option.

This reference page is updated to align with the ISO/IEC 9899:1999 standard.

The strerror_r() function is added in response to IEEE PASC Interpretation 1003.1c #39.

Issue 7

SD5-XBD-ERN-15 is applied, correcting the prototype for the strerror_r() function.

The stpcpy(), stpncpy(), strndup(), strnlen(), and strsignal() functions are added from The Open Group Technical Standard, 2006, Extended API Set Part 1.

The strcoll_l(), strerror_l(), and strxfrm_l() functions are added from The Open Group Technical Standard, 2006, Extended API Set Part 4.

This reference page is clarified with respect to macros and symbolic constants, and a declaration for the locale_t type is added.

Issue 8

Austin Group Defect 986 is applied, adding strlcat() and strlcpy().

Austin Group Defect 1061 is applied, adding memmem().

End of informative text.

 

return to top of page

UNIX® is a registered Trademark of The Open Group.
POSIX™ is a Trademark of The IEEE.
Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved
[ Main Index | XBD | XSH | XCU | XRAT ]