Giter VIP home page Giter VIP logo

42sp-cursus-libft's Introduction

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

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 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.