Skip to content

The aim of this project is to code printf for future project and learn how to use variadic arguments.

Notifications You must be signed in to change notification settings

ykoh42/ft_printf

Repository files navigation

Welcome to the ft_printf! score

ft_printf is the project, which recodes printf.

A format specifier follows this prototype :

%[flags][width][.precision][length]specifier

It works in the following conversions :

flags length specifier
-0# + l ll h hh diuoxXfegcspn%

The relationship chart between length and specifier

length d i u o x X f e g c s p n
(none) int unsigned int double int char * void * int *
hh signed char unsigned char signed char *
h short int unsigned short int short int *
l long int unsigned long int wint_t wchar_t * long int *
ll long long int unsigned long int long long int *

Tester

  • pft by gavinfielder

    git clone https://github.com/gavinfielder/pft.git pft && echo "pft/" >> .gitignore
  • PFT_2019 by cclaude42

    git clone https://github.com/gavinfielder/pft.git pft_2019 && echo "pft_2019/" >> .gitignore && cd pft_2019 && rm unit_tests.c && rm options-config.ini && git clone https://github.com/cclaude42/PFT_2019.git temp && cp temp/unit_tests.c . && cp temp/options-config.ini . && rm -rf temp
  • ft_printf_test by HappyTramp

    git clone https://github.com/HappyTramp/ft_printf_test.git
  • printf-tester by AntoineBourin

    git clone https://github.com/AntoineBourin/printf-tester.git
  • 42TESTERS-PRINTF by Mazoise

    git clone https://github.com/Mazoise/42TESTERS-PRINTF.git
  • 42cursus-printf-test-2019 by ggjulio

    git clone https://github.com/ggjulio/42cursus-printf-test-2019.git
  • ftprintfdestructor by t0mm4rx

    git clone https://github.com/t0mm4rx/ftprintfdestructor.git && cd ftprintfdestructor && sh run.sh ..
  • printf_lover_v2 by charMstr

    git clone https://github.com/charMstr/printf_lover_v2.git

Mandatory part

  • The prototype of ft_printf should be
    int ft_printf(const char *, ...);
  • You have to recode the libc’s printf function
  • It must not do the buffer management like the real printf
  • It will manage the following conversions: cspdiuxX%
  • It will manage any combination of the following flags: -0.* and minimum field width with all conversions
  • It will be compared with the real printf
  • You must use the command ar to create your librairy, using the command libtool is forbidden.

Bonus part

  • If the Mandatory part is not perfect don’t even think about bonuses
  • You don’t need to do all the bonuses
  • Manage one or more of the following conversions: nfge + o
  • Manage one or more of the following flags: l ll h hh
  • Manage all the following flags: # + (yes, one of them is a space)

About

The aim of this project is to code printf for future project and learn how to use variadic arguments.

Topics

Resources

Stars

Watchers

Forks