-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf_utils.c
More file actions
56 lines (48 loc) · 1.44 KB
/
Copy pathft_printf_utils.c
File metadata and controls
56 lines (48 loc) · 1.44 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
44
45
46
47
48
49
50
51
52
53
54
55
56
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ttorbeyn <ttorbeyn@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/03/26 19:11:56 by ttorbeyn #+# #+# */
/* Updated: 2021/03/31 18:35:20 by hubert ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_putchar(char c, t_flags *flags)
{
write(1, &c, 1);
flags->count = flags->count + 1;
}
void ft_putstr(char *s, t_flags *flags)
{
size_t i;
i = 0;
if (!s)
return ;
while (s[i])
{
ft_putchar(s[i], flags);
i++;
}
}
int ft_strlen(const char *s)
{
int i;
i = 0;
while (s[i] != '\0')
i++;
return (i);
}
int ft_isdigit(int c)
{
return (c >= '0' && c <= '9');
}
int ft_is_specifier(char c)
{
if (c == 'c' || c == 's' || c == 'd' || c == 'u' || c == 'i' || c == 'p'
|| c == 'x' || c == 'X' || c == '%')
return (1);
return (0);
}