Description · Usage · Testing
Coding legendary printf
function from standard ANCI C library.
Conversions included:
Specifier | %c |
%s |
%p |
%d |
%i |
%o |
%u |
%x |
%X |
%f |
%% |
---|
Flags included:
Flags | hh |
h |
l |
ll |
L |
# |
0 |
- |
+ |
' ' |
---|
Here is the basic format of how you can use ft_printf specifiers:
%[$][flags][width][.precision][length modifier]conversion
In the root of the repository, you have the Makefile
, which will handle the compiling of the library.
-
At the root of the repository simply run
make
. This will compile the library and the name will belibprintf.a
-
To use the
ft_printf
simply compile your.c
file/files and thelibprintf.a
.
/* main.c */
#include "./includes/ft_printf.h"
int main(void)
{
ft_printf("Hello World!\n");
}
gcc main.c libprintf.a
./a.out
Hello World!
Makefile
can be used to test ft_printf
simply run:
make test
This will create two files at the root of the repository
1.printf.txt
2.ft_prinft.txt
You can either use BASH command diff
to compare two files
diff printf.txt ft_prinft.txt
But better way is the use VScode feature compare selected:
testing.mov
More tests can be added to main.c
file. This can be found in eval_tests/
folder.
- Project scalability
- Reverse engineering
- Variadic functions
- Dispatcher/Jump table in C
- Array of function pointers