-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf.c
34 lines (31 loc) · 1.23 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tauer <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/14 18:11:10 by tauer #+# #+# */
/* Updated: 2023/11/15 16:08:16 by tauer ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *str, ...)
{
va_list arg;
int ret_size;
size_t i;
ret_size = 0;
i = 0;
va_start(arg, str);
while (str[i])
{
if (str[i] != '%')
ft_putchar_len(str[i], &ret_size);
else if (str[i + 1] != '\0' && str[i++] == '%')
ret_size = selecter(str[i], ret_size, arg);
i++;
}
va_end(arg);
return (ret_size);
}