Git Product home page Git Product logo

42_ft_printf's Introduction

ft_printf (@42Paris)

"Because putnbr and putstr aren’t enough"

Alt text

About

Ft_printf is a project of the mandatory part of the 42cursus. The main goal is to recreate the printf function in C. In this case we had to understand how the different parameters in printf works (width, height...).
This ft_printf handles all the bonuses from the subject.

  • Ft_printf will be able to work with :
    • Flags : -, 0, ., *
    • Conversions : %c, %s, %p, %d, %i, %u, %x, %X, %%
    • Bonus flags : l, ll, h, hh, #, +, and space
    • Bonus conversions : %n, %f, %e, %g

You can do combination between width / heigh / flags and conversions like the real printf.

For the bonus flag l, I had to implement the wide_char conversion for ls and lc combination. My ft_printf can so print unicode characters.

For the bonuses %f %e and %g (float conversion), I implemented the Dragon4 algorithm.
My implementation of the Dragon4 algorithm works like the real printf, so this ft_printf is able to print all the possible floats : from DBL_MAX (max double) to DBL_MIN (which will print 1024 numbers after the dot !).

In this case, I created a library (called BIG_INT library) that can do calculation on strings filled with number. This was necessary because floats algorithm needs to represent bigger number than possible with a long long int.
The BIG_INT library is able to perfom addition, subtraction, multiplication, division and pow.

This project was code for MACOS

Building and running the project

  1. Download/Clone this repo

     git clone https://github.com/lucaslefrancq/42_ft_printf
    
  2. cd into the root directory, and run make

     cd 42_ft_printf
     make
    
  3. Compile your main.c with the lib libftprintf.a created

    gcc -Wall -Werror -Wextra main.c libftprintf.a
    

Sources

42_ft_printf's People

Contributors

llefranc avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

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.