MyOS Libc
string.h File Reference
#include <stddef.h>

Go to the source code of this file.

Functions

void * memcpy (void *dest, const void *src, size_t len)
 
void * memset (void *dest, int val, size_t len)
 
int strcmp (const char *s1, const char *s2)
 
size_t strlen (const char *str)
 
char * strcpy (char *dest, const char *src)
 
char * strtok (const char *str, const char *delim)
 
char * strrev (char *str)
 
void int_to_ascii (int n, char *str)
 
void hex_to_ascii (unsigned int n, char *str)
 
void append (char *s, char n)
 
void backspace (char *s)
 

Function Documentation

◆ append()

void append ( char *  s,
char  n 
)

Appends a character to a string

Parameters
sThe string
nThe character to append

◆ backspace()

void backspace ( char *  s)

Deletes the last character of a string

Parameters
sThe string

◆ hex_to_ascii()

void hex_to_ascii ( unsigned int  n,
char *  str 
)

Converts a number to a base 16 string

Parameters
nThe number to convert
strA buffer to hold the converted number

◆ int_to_ascii()

void int_to_ascii ( int  n,
char *  str 
)

Converts a number to a base 10 string

Parameters
nThe number to convert
strA buffer to hold the converted number

◆ memcpy()

void* memcpy ( void *  dest,
const void *  src,
size_t  len 
)

Copies a block of memory from one address to another

Parameters
destThe destination address
srcThe source address
lenThe length of the block
Returns
the destination address

◆ memset()

void* memset ( void *  dest,
int  val,
size_t  len 
)

Sets a block of memory to a byte

Parameters
destThe block to set
valThe byte to set it to
lenThe length of the block
Returns
the destination address

◆ strcmp()

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

Compares two strings

Parameters
s1String 1 to compare
s2String 2 to compare
Returns
0 if the strings are the same, otherwise the difference between the values of the first non-identical character

◆ strcpy()

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

Copies a string from one address to another

Parameters
destThe destination string
srcThe source string
Returns
the destination string

◆ strlen()

size_t strlen ( const char *  str)

Gets the length of a string

Parameters
strThe string to get the length of
Returns
the length of the string

◆ strrev()

char* strrev ( char *  str)

Reverses a string in place

Parameters
strThe string to reverse
Returns
the string

◆ strtok()

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

Reads characters from a string until it hits a delimeter character

Parameters
strThe string to read from (or NULL if you are continuing tokenization)
delimA stribg containing possible delimeter characters.
Returns
the read characters, not including the delmimeter. This string will be overwritten by sucessive calls to strtok.