-
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.26 KB
/
ft_printf.c
File metadata and controls
41 lines (38 loc) · 1.26 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: rafael-m <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/22 15:46:58 by rafael-m #+# #+# */
/* Updated: 2025/04/25 16:44:13 by rafael-m ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include "ft_printf.h"
int ft_printf(char const *format, ...)
{
va_list ap;
int len;
len = 0;
if (!format)
return (-1);
va_start(ap, format);
while (*format)
{
if (*format == '%' && *(format + 1))
{
len += ft_check_format(*(format + 1), ap);
format += 2;
}
else
{
ft_putchar(*format);
format++;
len++;
}
}
va_end(ap);
return (len);
}