-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_printf.c
39 lines (36 loc) · 1.3 KB
/
ft_printf.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asibille <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/12 19:11:15 by asibille #+# #+# */
/* Updated: 2022/01/13 07:17:49 by asibille ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *format, ...)
{
size_t i;
int size;
va_list ptr_arg;
t_conv_flags fl;
i = 0;
size = 0;
va_start(ptr_arg, format);
while (format[i])
{
if (format[i] != '%')
ft_putchar_count(format[i++], 1, &size);
else
{
++i;
ft_init_conv_flags(&fl);
ft_fill_conv_flags(&fl, format, &i);
ft_print_conv(ptr_arg, &fl, &size);
}
}
va_end(ptr_arg);
return (size);
}