Bonus preparartion

This commit is contained in:
David Gailleton
2025-11-19 15:14:53 +01:00
parent 836eea81e1
commit 66878549eb
12 changed files with 297 additions and 122 deletions

24
bonus/print_hex_bonus.c Normal file
View File

@@ -0,0 +1,24 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_hex_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/17 12:06:35 by dgaillet #+# #+# */
/* Updated: 2025/11/19 13:35:40 by dgaillet ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include "ft_printf_bonus.h"
#include <unistd.h>
int print_hex(unsigned long long nbr, int upper)
{
if (nbr == 0)
return (write(1, "0", 1));
if (upper)
return (ft_putnbr_base(nbr, "0123456789ABCDEF", 16));
else
return (ft_putnbr_base(nbr, "0123456789abcdef", 16));
}