-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_puthex.c
More file actions
29 lines (26 loc) · 1.18 KB
/
ft_puthex.c
File metadata and controls
29 lines (26 loc) · 1.18 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_puthex.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mmounsif <mmounsif@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/07 20:03:12 by mmounsif #+# #+# */
/* Updated: 2024/12/11 19:38:08 by mmounsif ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_puthex(unsigned int n, int i, int *count)
{
char *hexa0;
char *hexa1;
hexa0 = "0123456789abcdef";
hexa1 = "0123456789ABCDEF";
if (n >= 16)
ft_puthex(n / 16, i, count);
if (i == 0)
write(1, &hexa0[n % 16], 1);
else if (i == 1)
write(1, &hexa1[n % 16], 1);
(*count)++;
}