The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
string.h File Reference

This file contains the declarations of string manipulation functions. More...

#include <sys/types.h>

Go to the source code of this file.

Macros

#define NULL   ((void *)0)

Functions

size_t strlen (const char *s)
 computes the length of the string s.
int strcmp (const char *s1, const char *s2)
 compares the string s1 to the string s2.
int strncmp (const char *s1, const char *s2, size_t n)
 compares the first n bytes of the string s1 to the first n bytes of the string s2.
char * strcpy (char *dst, const char *src)
 copies the string pointed to by src, including the terminating null byte ('\0'), to the buffer pointed to by dst.
char * strncpy (char *dst, const char *src, size_t n)
 copies up to n bytes from the string pointed to by src to the buffer pointed to by dst.
char * strcat (char *dst, const char *src)
 appends the string pointed to by src to the end of the string pointed to by dst.
char * strchr (const char *s, int c)
 appends up to n bytes from the string pointed to by src to the end of the string pointed to by dst.
char * strrchr (const char *s, int c)
 locates the last occurrence of c (converted to a char) in the string pointed to by s.
char * strtok (char *str, const char *delim)
 tokenizes the string str using the delimiters specified in delim.
void * memcpy (void *dst, const void *src, size_t n)
 copies n bytes from memory area src to memory area dst.
void * memset (void *dst, int c, size_t n)
 fills the first n bytes of the memory area pointed to by dst with the constant byte c.
int memcmp (const void *s1, const void *s2, size_t n)
 compares the first n bytes of the memory areas s1 and s2.
void * memmove (void *dst, const void *src, size_t n)
 copies n bytes from memory area src to memory area dst.
size_t strnlen (const char *s, size_t max)
char * strncat (char *dst, const char *src, size_t n)
char * strdup (const char *s)
char * strndup (const char *s, size_t n)
char * strstr (const char *haystack, const char *needle)
char * strpbrk (const char *s, const char *accept)
size_t strspn (const char *s, const char *accept)
size_t strcspn (const char *s, const char *reject)
char * strtok_r (char *str, const char *delim, char **saveptr)
int strcasecmp (const char *a, const char *b)
int strncasecmp (const char *a, const char *b, size_t n)
int strcoll (const char *a, const char *b)
void * memchr (const void *s, int c, size_t n)
const char * strerror (int errnum)
char * strsignal (int sig)
 a description of a signal ("Terminated"), or "Unknown signal N"

Detailed Description

This file contains the declarations of string manipulation functions.

Macro Definition Documentation

◆ NULL

#define NULL   ((void *)0)

Function Documentation

◆ strlen()

size_t strlen ( const char * s)

computes the length of the string s.

Parameters
sthe string to compute the length of.
Returns
the length of the string s, excluding the terminating null byte ('\0').

◆ strcmp()

int strcmp ( const char * s1,
const char * s2 )

compares the string s1 to the string s2.

Parameters
s1the first string to compare.
s2the second string to compare.
Returns
an integer less than, equal to, or greater than zero if s1 is

◆ strncmp()

int strncmp ( const char * s1,
const char * s2,
size_t n )

compares the first n bytes of the string s1 to the first n bytes of the string s2.

Parameters
s1the first string to compare.
s2the second string to compare.
nthe number of bytes to compare.
Returns
an integer less than, equal to, or greater than zero if the first n

◆ strcpy()

char * strcpy ( char * dst,
const char * src )

copies the string pointed to by src, including the terminating null byte ('\0'), to the buffer pointed to by dst.

Parameters
dstthe destination buffer.
srcthe source string to copy.
Returns
a pointer to the destination string dst.

◆ strncpy()

char * strncpy ( char * dst,
const char * src,
size_t n )

copies up to n bytes from the string pointed to by src to the buffer pointed to by dst.

Parameters
dstthe destination buffer.
srcthe source string to copy.
nthe maximum number of bytes to copy.
Returns
a pointer to the destination string dst.

◆ strcat()

char * strcat ( char * dst,
const char * src )

appends the string pointed to by src to the end of the string pointed to by dst.

Parameters
dstthe destination string to which src will be appended.
srcthe source string to append.
Returns
a pointer to the destination string dst.

◆ strchr()

char * strchr ( const char * s,
int c )

appends up to n bytes from the string pointed to by src to the end of the string pointed to by dst.

Parameters
dstthe destination string to which src will be appended.
srcthe source string to append.
nthe maximum number of bytes to append.
Returns
a pointer to the destination string dst.

◆ strrchr()

char * strrchr ( const char * s,
int c )

locates the last occurrence of c (converted to a char) in the string pointed to by s.

Parameters
sthe string to search.
cthe character to locate.
Returns
a pointer to the last occurrence of c in s, or NULL if c is not found.

◆ strtok()

char * strtok ( char * str,
const char * delim )

tokenizes the string str using the delimiters specified in delim.

Parameters
strthe string to tokenize. On the first call, str should point to the string to tokenize. On subsequent calls, str should be NULL.
delima string containing the delimiters to use for tokenization.
Returns
a pointer to the next token found in str, or NULL if no more tokens are found.

◆ memcpy()

void * memcpy ( void * dst,
const void * src,
size_t n )

copies n bytes from memory area src to memory area dst.

The memory areas must not overlap.

Parameters
dstthe destination memory area.
srcthe source memory area.
nthe number of bytes to copy.
Returns
a pointer to the destination memory area dst.

◆ memset()

void * memset ( void * dst,
int c,
size_t n )

fills the first n bytes of the memory area pointed to by dst with the constant byte c.

Parameters
dstthe memory area to fill.
cthe byte to fill the memory area with.
nthe number of bytes to fill.
Returns
a pointer to the memory area dst.

◆ memcmp()

int memcmp ( const void * s1,
const void * s2,
size_t n )

compares the first n bytes of the memory areas s1 and s2.

Parameters
s1the first memory area to compare.
s2the second memory area to compare.
nthe number of bytes to compare.
Returns
an integer less than, equal to, or greater than zero if the first n bytes of s1 are found, respectively, to be less than, to match, or be greater than the first n bytes of s2.

◆ memmove()

void * memmove ( void * dst,
const void * src,
size_t n )

copies n bytes from memory area src to memory area dst.

The memory areas may overlap.

Parameters
dstthe destination memory area.
srcthe source memory area.
nthe number of bytes to copy.
Returns
a pointer to the destination memory area dst.

◆ strnlen()

size_t strnlen ( const char * s,
size_t max )

◆ strncat()

char * strncat ( char * dst,
const char * src,
size_t n )

◆ strdup()

char * strdup ( const char * s)

◆ strndup()

char * strndup ( const char * s,
size_t n )

◆ strstr()

char * strstr ( const char * haystack,
const char * needle )

◆ strpbrk()

char * strpbrk ( const char * s,
const char * accept )

◆ strspn()

size_t strspn ( const char * s,
const char * accept )

◆ strcspn()

size_t strcspn ( const char * s,
const char * reject )

◆ strtok_r()

char * strtok_r ( char * str,
const char * delim,
char ** saveptr )

◆ strcasecmp()

int strcasecmp ( const char * a,
const char * b )

◆ strncasecmp()

int strncasecmp ( const char * a,
const char * b,
size_t n )

◆ strcoll()

int strcoll ( const char * a,
const char * b )

◆ memchr()

void * memchr ( const void * s,
int c,
size_t n )

◆ strerror()

const char * strerror ( int errnum)

◆ strsignal()

char * strsignal ( int sig)

a description of a signal ("Terminated"), or "Unknown signal N"