-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_fscheck.c
35 lines (32 loc) · 1.4 KB
/
ft_fscheck.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
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_fscheck.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yanflous <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/25 21:36:48 by yanflous #+# #+# */
/* Updated: 2024/11/25 21:39:45 by yanflous ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_fscheck(va_list arg, char c)
{
int count;
count = 0;
if (c == 'c')
count += ft_putchar(va_arg(arg, int));
else if (c == 's')
count += ft_putstr(va_arg(arg, char *));
else if (c == 'd' || c == 'i')
count += ft_putnbr(va_arg(arg, int));
else if (c == 'x' || c == 'X')
count += ft_puthex(va_arg(arg, unsigned int), c);
else if (c == 'u')
count += ft_putuint(va_arg(arg, unsigned int));
else if (c == 'p')
count += ft_putadd(va_arg(arg, void *));
else
count += ft_putchar(c);
return (count);
}