Skip to content

Latest commit

 

History

History
78 lines (62 loc) · 2.01 KB

README.md

File metadata and controls

78 lines (62 loc) · 2.01 KB

Libft-Printf

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>

More fun things.

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).

How to ...

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.

Requirements

  • 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

Run it

  1. In your terminal you need to go to the folder you just have download
cd libft
  1. 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
  1. The previous command makes you to have some "residuos" that are not needed for what we want to do.
make clean
  1. Create a main file.
touch main.c
  1. Copy this code insidemain.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);
 }
  1. Compile the main file with the library.
cc main.c libft.a -o executable
  1. Execute the program
./executable
  1. Play around, make changes to the code and have fun