42Madrid printf proyect implementation
This proyect consists in creating a library that contains the essential information to reproduce printf
C standard library's function. In this proyect we were allowed to use libft funcions. Some of their behavior have changed, in order to gain extra functionality to make printf run properly and not recreating functions.
-
Clone the repository:
git clone https:://github.com/riveroo19/42my_printf.git
-
Go inside the proyect directory and type
make
:cd 42my_printf; make
-
(Optional) Remove object files:
make clean
-
Take
libftprintf.a
file to one of your proyects and include the ft_printf header on your files:
#include "path/to/ft_printf.h"
/*
code
*/
-
Compile using
libftprintf.a
:gcc <.c files> -L. -lft -o <program> ./<program>
all
: compiles the libraryre
: recompiles the libraryclean
: removes all object filesfclean
: removeslibft.a
and object files
It supports the following conversion specifiers:
Specifier | Output |
---|---|
%c |
A character |
%s |
String |
%p |
Pointer address |
%d |
Decimal (base 10) number |
%i |
Integer in base 10 |
%u |
Unsigned decimal (base 10) number |
%x |
Unsigned hexadecimal (lowercase) |
%X |
Unsigned hexadecimal (uppercase) |
%% |
Prints % character |
It works as printf
, but the conversion types supported are limited, and the extra functionalities.
At 42School, almost every project must be written in accordance to the Norm, the school's coding standard. As a result, the implementation of certain parts may appear strange and for sure had room for improvement.