In this repository I made some implementation of functions from the following libraries: <stdlib.h>
, <string.h>
, <ctype.h>
.
As well as my onw implementation of printf from <stdio.h>
The second part of this project was the implementation of Linked Lists, creation of split function and I/O to file descriptors.
I also created a Makefile to help in the compilation process. With the Makefile you can make a statically linked library (libft.a).
There are many ways to Rome. If you already know about make files, c compilers and C language, you don't need to read this. But if you don't have any idea. I hope this is helpful.
- I have GCC compiler installed. (If not check below 'How to install gcc')
- I have installed make.
- I've cloned this repository:
git clone https://github.com/nucata/libft.git
- In your terminal you need to go to the folder you just have download
cd libft
- You need to create the statically linked library (Somthing like putting all the functions together in a file)
make
Now you can check that you have the library by doing
ls libft.a
- The previous command makes you to have some "residuos" that are not needed for what we want to do.
make clean
- Create a main file.
touch main.c
- Copy this code inside
main.c
.
#include "libft.h" // Here are the prototypes of my functions.
int main(void)
{
char *text = "This will be a list of words";
char **words = ft_split(text, ' '); // This will take the text and split it into a list of words, each word delimitated by the other by a space.
for (int i = 0; i < 7; i++)
{
ft_putstr_fd(words[i], 1);
ft_putchar_fd('\t', 1);
}
return (0);
}
- Compile the main file with the library.
cc main.c libft.a -o executable
- Execute the program
./executable
- Play around, make changes to the code and have fun