/libft

Primary LanguageC

42 Cursus' libft

This repo is my first project as a cadet @42rio.
It acts as both a study project on replicating libc functions, as well as a developer toolbelt to be used throughout the cursus.

Functions from <ctype.h>

Functions from <stdlib.h>

  • ft_atoi - converts ASCII to integer.
  • ft_calloc - allocate and initialize to 0 a block of memory.

Functions from <string.h> && <strings.h>

  • ft_strlen - gets the lenght of a null terminated string.
  • ft_strdup - duplicates a string (with malloc).
  • ft_strnstr - searches for the occurence of a byte stream inside another byte stream.
  • ft_strchr - searches for the first occurence of a byte in a byte stream.
  • ft_strrchr - searches for the last occurence of a byte in a byte stream.
  • ft_strlcpy - copies the string src to dst.
  • ft_strlcat - concatenates two strings.
  • ft_strncmp - compares the first n bytes of two byte streams.
  • ft_memset - fill a byte stream with a value.
  • ft_bzero - fill a byte stream with zero.
  • ft_memcpy - copy a byte stream (doesn't account for overlapping memory blocks).
  • ft_memmove - copy a byte stream (accounts for overlapping memory blocks).
  • ft_memchr - search for a byte in the first n bytes of a byte stream.
  • ft_memcmp - compare two byte streams.

Nonstandard functions

  • ft_itoa - returns a malloc'd string from an int.
  • ft_strndup - returns a malloc'd copy of the first n bytes of a string.
  • ft_substr - creates a new string from a portion of a given string.
  • ft_strjoin - joins two strings (with malloc).
  • ft_strtrim - trailes off the matching char from the beginning and end of a string.
  • ft_split - splits a string into malloc'd matrix.
  • ft_strmapi - returns malloc'd string that is the result of successive iterations of a function over a given string.
  • ft_striteri - iterates a given function over each position of a given string.
  • ft_putchar - prints a char to stdout.
  • ft_putchar_fd - writes a char to the given file descriptor.
  • ft_putstr - writes a string to stdout.
  • ft_putstr_fd - writes a string to the given file descriptor.
  • ft_putendl - writes a string followed by a \n to stdout.
  • ft_putendl_fd - writes a string followed by a \n to the given file descriptor.
  • ft_putnbr_fd - writes a number to stdout.
  • ft_putnbr_fd - writes a number into the given file descriptor.
  • get_next_line - my implementation of the GNU get_next_line.
  • ft_printf - my implementation of the printf function.