The ft_printf function prints a formatted string to standard output. It's a useful way to produce precisely formatted results from numerical or textual arguments.
Conversion | Description |
---|---|
%c | Single ascii character |
%s | String of characters NULL terminated |
%p | Pointer location converted to hexadecimal value |
%d | Decimal number |
%i | Integer in decimal base |
%u | Unsigned integer in decimal base |
%x | Unsigned number printed in lowercase hexadecimal base |
%X | Unsigned number printed in uppercase hexadecimal base |
%% | The '%' ascii character |
Flags | Description |
---|---|
+ | Add a plus sign ('+') in the front of positive numeric conversions |
# | Add the corresponding prefix in front of x, X and o conversions |
(space) | Add a single space (' ') in the front of positive numeric conversions |
Clone this repository in your local computer and cd
into it:
$> git clone https://github.com/educastrob/ft_printf.git && cd ft_printf
In your local repository, run make
$> make
make
suports 4 flags:
make all
or simplymake
compiles printf in its mandatory formatmake clean
deletes the.o
files generated during compilationmake fclean
deletes the.o
and thelibftprintf.a
library file generatedmake re
executesfclean
andall
in sequence, recompiling the library
To use the ft_printf in your code you will need to include the header:
#include "ft_printf.h"
When compiling your own code with libftprintf
, don't forget to use the flags:
$> ... -lftprintf -L path/to/libftprintf.a -I path/to/ftprintf.h