-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf_store_n_bonus.c
31 lines (28 loc) · 1.3 KB
/
ft_printf_store_n_bonus.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_store_n_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dnakano <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/10/18 10:25:16 by dnakano #+# #+# */
/* Updated: 2020/10/18 14:25:16 by dnakano ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdarg.h>
#include "libftprintf.h"
void ft_printf_store_n(va_list *ap, t_printf_flags *flags, int count)
{
long long *n;
n = (long long *)va_arg(*ap, t_ullong);
if (flags->flag & FLAG_LONGLONG)
*n = (long long)count;
else if (flags->flag & FLAG_LONG)
*n = (long)count;
else if (flags->flag & FLAG_SHORTSHORT)
*n = (signed char)count;
else if (flags->flag & FLAG_SHORT)
*n = (short)count;
else
*n = (int)count;
}