Skip to content

This project is about coding a C library. It will contain a lot of general purpose functions your programs will rely upon.

License

Notifications You must be signed in to change notification settings

pix3l-p33p3r/libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libft

42cursus' project #1

In this repo you will find all the codes developed during the libft project, both mandatory's Parts 1 and 2 and bonus functions, as well as other functions that I may find useful later on. These functions must be compiled (through a Makefile) into a libft.a library for my own use further on the 42cursus' syllabus.


Final score

cado-car's

Completed + Bonus

cado-car's

RTFM

cado-car's

Part 1

In this first part, you must re-code a set of the libc functions, as defined in their man. Your functions will need to present the same prototype and behaviors as the originals. Your functions’ names must be prefixed by “ft_”. For instance strlen becomes ft_strlen.

• isalpha • isdigit • isalnum • isascii • isprint • strlen • memset • bzero • memcpy • memmove • strlcpy • strlcat • toupper • tolower • strchr • strrchr • strncmp • memchr • memcmp • strnstr • atoi

Part 2

In this second part, you must code a set of functions that are either not included in the libc, or included in a different form. Some of these functions can be useful to write Part 1’s functions.

• substr • strjoin • strtrim • split • itoa • strmapi • striteri • putchar_fd • putstr_fd • putendl_fd • putnbr_fd

Bonus

The following functions will allow you to easily use your lists.

• lstnew • lstadd_front • lstsize • lstlast • lstadd_back • lstdelone • lstclear • lstiter • lstmap


The project

Functions from <ctype.h>

Functions from <string.h>

Functions from <stdlib.h>

  • ft_atoi - convert a string to an integer
  • ft_calloc - allocates memory and sets its bytes' values to 0

Non-standard functions

  • ft_substr - returns a substring from a string
  • ft_strjoin - concatenates two strings
  • ft_strtrim - trims the beginning and end of string with specific set of chars
  • ft_split - splits a string using a char as parameter
  • ft_itoa - converts a number into a string
  • ft_strmapi - applies a function to each character of a string
  • ft_striteri - applies a function to each character of a string
  • ft_putchar_fd - output a char to a file descriptor
  • ft_putstr_fd - output a string to a file descriptor
  • ft_putendl_fd - output a string to a file descriptor, followed by a new line
  • ft_putnbr_fd - output a number to a file descriptor

Linked list functions


Usage

Requirements

libft requires a gcc compiler and some standard libraries.

Instructions

Clone this repository in your local computer:

$> git clone https://github.com/caroldaniel/42sp-cursus_libft.git path/to/libft

In your local repository, run make

$> make 

make suports 6 flags:

  • make all or simply make compiles only the mandatory functions
  • make bonus compiles the bonus functions
  • make clean deletes the .o files generated during compilation
  • make fclean deletes the .o and the libft.a library file generated
  • make re executes fclean and all in sequence, recompiling the library without the bonus functions
  • make rebonus executes fclean and bonus in sequence, recompiling the library with the bonus functions

To use the library in your code you will need to include the header:

#include "libft.h" 

When compiling your own code with libft, don't forget to use the flags:

$> ... -lft -L path/to/libft.a -I path/to/libft.h 

About

This project is about coding a C library. It will contain a lot of general purpose functions your programs will rely upon.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published