-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf.c
More file actions
38 lines (35 loc) · 1.2 KB
/
ft_printf.c
File metadata and controls
38 lines (35 loc) · 1.2 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: amarjan <amarjan@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/18 12:04:01 by amarjan #+# #+# */
/* Updated: 2026/01/18 12:08:36 by amarjan ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *s, ...)
{
va_list ap;
int count;
if (!s || write(1, "", 0) == -1)
return (-1);
va_start(ap, s);
count = 0;
while (*s)
{
if (*s == '%')
{
++s;
if (*s)
count += ft_conversions(*s, ap);
}
else
count += write(1, s, 1);
++s;
}
va_end(ap);
return (count);
}