-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf_utils.c
More file actions
51 lines (44 loc) · 1.4 KB
/
ft_printf_utils.c
File metadata and controls
51 lines (44 loc) · 1.4 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dporhomo <dporhomo@student.42prague.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/02 15:57:50 by dporhomo #+# #+# */
/* Updated: 2025/12/09 16:56:37 by dporhomo ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_isdigit(int c)
{
return (c >= '0' && c <= '9');
}
int ft_isspec(int c)
{
return ((c == 'c' || c == 's' || c == 'p' || c == 'd' || c == 'i'
|| c == 'u' || c == 'x' || c == 'X' || c == '%'));
}
int ft_print_padding(int width, int size, int zero)
{
int count;
count = 0;
while (width - size > 0)
{
if (zero)
write(1, "0", 1);
else
write(1, " ", 1);
count++;
width--;
}
return (count);
}
size_t ft_strlen(const char *s)
{
size_t len;
len = 0;
while (s[len])
len++;
return (len);
}