-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_print_hexlow.c
More file actions
49 lines (43 loc) · 1.33 KB
/
ft_print_hexlow.c
File metadata and controls
49 lines (43 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_hexlow.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bhielsch <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/20 10:30:29 by bhielsch #+# #+# */
/* Updated: 2022/10/20 10:31:51 by bhielsch ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
static void ft_putchar(char c);
int ft_print_hexlow(unsigned int nb, int count)
{
int i;
i = count;
if (nb >= 16)
{
i++;
i = ft_print_hexlow(nb / 16, i);
nb = nb % 16;
}
if (nb < 10)
{
ft_putchar(nb + 48);
}
else
{
ft_putchar(nb + 87);
}
return (i);
}
void ft_putchar(char c)
{
write(1, &c, 1);
}
// int main()
// {
// int i = 1;
// int nb = 4294967295;
// printf("\nLen:%d\n", ft_print_hexlow(nb, i));
// }