From 95ccc46ad62c59e648679acad8b44ba5d4465e3d Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Wed, 8 May 2024 13:14:19 +0200 Subject: Add libft as dir --- libft/ft_printhex.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 libft/ft_printhex.c (limited to 'libft/ft_printhex.c') diff --git a/libft/ft_printhex.c b/libft/ft_printhex.c new file mode 100644 index 0000000..4605eac --- /dev/null +++ b/libft/ft_printhex.c @@ -0,0 +1,44 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_printhex.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dkaiser 15) + printhex_rec(nbr / 16, fmt, len); + if (*len < 0) + return ; + success = write(1, &c, 1); + if (success < 0) + *len = -1; + else + (*len)++; +} + +int ft_printhex(unsigned int nbr, char fmt) +{ + int len; + + len = 0; + printhex_rec(nbr, fmt, &len); + return (len); +} -- cgit v1.2.3