-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putunbr_hex.c
29 lines (26 loc) · 1.37 KB
/
ft_putunbr_hex.c
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_putunbr_hex.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tunsal <tunsal@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/05 16:48:27 by tunsal #+# #+# */
/* Updated: 2023/11/05 16:48:36 by tunsal ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
/*
Write number `n` into standard output in hexadecimal base
and return the number of characters printed.
Return -1 if ft_putsize_base fails or upon any error.
Uppercase hexadecimal notation will be used if `use_uppercase_notation`
flag is true.
*/
int ft_putunbr_hex(unsigned int n, int use_uppercase_notation)
{
if (use_uppercase_notation)
return (ft_putsize_base((size_t) n, "0123456789ABCDEF"));
else
return (ft_putsize_base((size_t) n, "0123456789abcdef"));
}