Skip to content

spnzed/ft_printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

ft_printf

42cursus' project #3

This project is pretty straightforward, you have to recode printf. You will learn what is and how to implement variadic functions. Once you validate it, you will reuse this function in your future projects. The printf function is one of the most versatile and well-known functions in the C language. From a testing aid to tabulation method, printf is a very powerful and important tool in every dev's kit. This project aims to recreate the behaviour of the original MacOS's printf, including its basic error management, some of its flags, minimum field width stipulation and most of its basic conversions.

ft_printfe


Mandatory

A small description of the required conversion:

  • %c print a single character.
  • %s print a string of characters.
  • %p The void * pointer argument is printed in hexadecimal.
  • %d print a decimal (base 10) number.
  • %i print an integer in base 10.
  • %u print an unsigned decimal (base 10) number.
  • %x print a number in hexadecimal (base 16).
  • %% print a percent sign.

The project

Implementation files

Main

Conversion functions

Conversions & Flags & Expected Order

Conversion Description Project
c Single ascii character Mandatory
s String of characters NULL terminated Mandatory
p Pointer location converted to hexadecimal value Mandatory
d Decimal number Mandatory
i Integer in decimal base Mandatory
u Unsigned integer in decimal base Mandatory
x Unsigned number printed in lowercase hexadecimal base Mandatory
X Unsigned number printed in uppercase hexadecimal base Mandatory
% The '%' ascii character Mandatory
o Unsigned number printed in octal base Extra

Usage

Requirements

ft_printf requires a gcc compiler and some standard libraries.

Instructions

Clone this repository in your local computer:

$> git clone https://github.com/spnzed/ft_printf.git

In your local repository, run make

$> make 

make suports 6 flags:

  • make all or simply make compiles printf in its mandatory format
  • make clean deletes the .o files generated during compilation
  • make fclean deletes the .o and the libftprintf.a library file generated
  • make re executes fclean and all in sequence, recompiling the library

To use the libftprintf in your code you will need to include the header:

#include "ft_printf.h" 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published