-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf.c
More file actions
42 lines (38 loc) · 1.39 KB
/
ft_printf.c
File metadata and controls
42 lines (38 loc) · 1.39 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ssb <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/01/08 05:31:00 by ssb #+# #+# */
/* Updated: 2021/01/13 19:57:38 by ssb ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *hagisilta, ...)
{
int return_v;
va_list ap;
const char *bowl;
int i;
t_flag flags;
va_start(ap, hagisilta);
bowl = hagisilta;
return_v = 0;
i = -1;
while (bowl[++i])
{
if (bowl[i] == '%')
{
ft_bzero(&flags, sizeof(flags));
flags.precision = -1;
i = ft_flag_set(bowl, i, ap, &flags);
return_v += ft_type_path(&flags, ap);
}
else
return_v += ft_putchar(bowl[i]);
}
va_end(ap);
return (return_v);
}