-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf_utils.c
45 lines (40 loc) · 1.25 KB
/
ft_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cvidot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/16 11:02:24 by cvidot #+# #+# */
/* Updated: 2023/07/16 11:03:25 by cvidot ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_strlen(const char *s)
{
int i;
i = 0;
while (s[i] != '\0')
i++;
return (i);
}
int ft_print_char(char c)
{
write(1, &c, 1);
return (1);
}
int ft_print_str(char const *s)
{
int i;
int printed_chars;
i = 0;
if (!s)
s = "(null)";
printed_chars = ft_strlen(s);
while (s[i])
{
ft_print_char(s[i]);
i++;
}
return (printed_chars);
}