Library that contains ft_printf, a function that will mimic the real printf, It will manage the following conversions [ cspdiuxX%]
#include "../includes/ft_printf.h"
int ft_printf(const char *format, ...)
{
t_info *info;
int length;
info = (t_info *)ft_memalloc(sizeof(t_info));
va_start(info->arguments, format);
info->format = format;
while (*info->format)
{
while (*info->format && *info->format != '%')
{
ft_putchar(*info->format);
info->total_length++;
info->format++;
}
if (*info->format && *info->format == '%')
ft_eval_input(info);
}
va_end(info->arguments);
length = info->total_length;
free(info);
return (length);
}
🐾 General workflow 🐾
- 🌱 Format Specifier - Char
- 🌱 Format Specifier - String
- 🌱 Format Specifier - Interger
- 🌱 Format Specifier - Pointer
- 🌱 Format Specifier - Unsigned
[ flags ] [ width ] [ precision ]
make all
gcc ./tests/01_main_test_c.c libftprintf.a -I ./include/
Note.: You can use "make re" to clean and build again
First change your Makefile, adding -g3
@$(CC) -g3 $(CFLAGS) $(SRCS) -I$(INCLUDES)
Then, execute:
cd {$HOME}/42-silicon-valley-ft-printf
make all
gcc -g3 ./tests/01_main_test_c.c libftprintf.a
gcc -g3 ./tests/02_main_test_s.c libftprintf.a
gcc -g3 ./tests/03_main_test_di.c libftprintf.a
gcc -g3 ./tests/04_main_test_p.c libftprintf.a
gcc -g3 ./tests/05_main_test_x.c libftprintf.a
gcc -g3 ./tests/06_main_test_u.c libftprintf.a
lldb a.out
b main
run
gui
- ESTERS-PRINTF (passed) from Mazoise
- pft (passed) from gavinfielder
- PRINTF_TESTER from Kwevan
- printf_lover_v2 from charMstr
- https://docs.google.com/document/d/1znc7N5ua3WC1PhGcirRhtadHYSrPK3wxTApMdlJXYes/edit?pli=1#
- https://www.cplusplus.com/reference/cstdio/printf/
- https://www.cypress.com/file/54441/download
- http://www.cplusplus.com/reference/cstdio/printf/
Use and install this repository: Norminette
echo 'alias norminette="~/.norminette/norminette.rb"' >> ~/.profile
source ~/.profile
norminette *.*
make all
gcc ./tests/01_main_test_c.c libftprintf.a -I ./include/
gcc ./tests/02_main_test_s.c libftprintf.a -I ./include/
gcc ./tests/03_main_test_di.c libftprintf.a -I ./include/
gcc ./tests/04_main_test_p.c libftprintf.a -I ./include/
gcc ./tests/05_main_test_x.c libftprintf.a -I ./include/
gcc ./tests/06_main_test_u.c libftprintf.a -I ./include/
gcc ./tests/07_main_test_prc.c libftprintf.a -I ./include/
valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-origins=yes --track-fds=yes ./a.out