-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_hex_formater.c
More file actions
35 lines (32 loc) · 1.24 KB
/
ft_hex_formater.c
File metadata and controls
35 lines (32 loc) · 1.24 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_hex_formater.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: pabad-ap <pabad-ap@student.42barcel> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/28 10:51:16 by pabad-ap #+# #+# */
/* Updated: 2023/10/29 23:24:57 by pabad-ap ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_hex_formater(unsigned int n, int *str_len)
{
char *code;
code = "0123456789abcdef";
if (n >= 16)
{
ft_hex_formater(n / 16, str_len);
if (*str_len == -1)
return ;
ft_char_formater(code[n % 16], str_len);
if (*str_len == -1)
return ;
}
else
{
ft_char_formater(code[n % 16], str_len);
if (*str_len == -1)
return ;
}
}