-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf.c
More file actions
41 lines (38 loc) · 1.32 KB
/
ft_printf.c
File metadata and controls
41 lines (38 loc) · 1.32 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lle-briq <lle-briq@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/11/26 18:04:46 by lle-briq #+# #+# */
/* Updated: 2020/12/30 15:05:57 by lle-briq ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *str, ...)
{
va_list args;
t_print param;
int nb_char;
if (!is_all_coherent(str))
return (0);
va_start(args, str);
nb_char = 0;
while (*str)
{
if (*str != '%')
str = print_str_classic(str, &nb_char);
else
{
str++;
init_param(¶m);
str = parse_param(¶m, str, args);
if (!str)
return (0);
print_param(param, args, &nb_char);
}
}
va_end(args);
return (nb_char);
}