-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_write.c
More file actions
43 lines (37 loc) · 1.38 KB
/
ft_write.c
File metadata and controls
43 lines (37 loc) · 1.38 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_write.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mdumitru <mdumitru@student.42roma.it> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/20 18:32:14 by mdumitru #+# #+# */
/* Updated: 2024/10/20 18:32:24 by mdumitru ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_hex_print(unsigned int n, const char type)
{
char *base;
base = "0123456789abcdef";
if (n / 16)
ft_hex_print(n / 16, type);
if (type == 'X')
ft_putchar_fd(ft_toupper(base[n % 16]), 1);
else
ft_putchar_fd(base[n % 16], 1);
}
void ft_unbr_print(unsigned int n)
{
if (n / 10)
ft_putunbr(n / 10);
ft_putchar(n % 10 + '0');
}
void ft_ptr_print(unsigned long n)
{
char *base;
base = "0123456789abcdef";
if (n / 16)
ft_ptr_print(n / 16);
ft_putchar_fd(base[n % 16], 1);
}