-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprintf_utils.c
53 lines (47 loc) · 1.37 KB
/
printf_utils.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* printf_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ybarbot <ybarbot@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/16 15:33:43 by ybarbot #+# #+# */
/* Updated: 2023/11/20 16:25:35 by ybarbot ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_putlchar(char c)
{
write(1, &c, 1);
return (1);
}
int ft_putlstr(const char *str)
{
int i;
if (str == NULL)
{
write(1, "(null)", 6);
return (6);
}
i = 0;
while (str[i])
{
write(1, &str[i], 1);
i++;
}
return (i);
}
int ft_display_adress(unsigned long ptr)
{
int counter;
if (!ptr)
{
write(1, "(nil)", 5);
return (5);
}
counter = 0;
write(1, "0x", 2);
counter += 2;
counter += ft_putlnbr_ulongbase(ptr, "0123456789abcdef");
return (counter);
}