-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf.c
More file actions
36 lines (33 loc) · 1.24 KB
/
ft_printf.c
File metadata and controls
36 lines (33 loc) · 1.24 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: macuesta <macuesta@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/15 08:15:54 by macuesta #+# #+# */
/* Updated: 2024/11/15 13:18:47 by macuesta ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *fm, ...)
{
va_list args;
int len;
int i;
len = 0;
i = 0;
va_start(args, fm);
while (fm && fm[i])
{
if (fm[i] && fm[i + 1] && fm[i] == '%' && is_a_formatter(fm[i + 1]))
{
len += ft_dispatcher(fm[i + 1], &args);
i += 2;
}
else
len += ft_print_until_format(fm + i, &i);
}
va_end(args);
return (len);
}