-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf_putbyte.c
More file actions
28 lines (25 loc) · 1.26 KB
/
ft_printf_putbyte.c
File metadata and controls
28 lines (25 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_putbyte.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dnakano <dnakano@student.42tokyo.jp> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/10/12 11:52:05 by dnakano #+# #+# */
/* Updated: 2020/10/18 14:25:25 by dnakano ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
int ft_printf_putbyte(va_list *ap, t_printf_flags *flags)
{
t_uchar c;
if (flags->width == -1)
flags->width = 0;
c = (t_uchar)va_arg(*ap, t_ullong);
if (flags->flag & FLAG_LEFTADJUST)
ft_putchar_fd(c, 1);
ft_printf_putpadding(flags->width - 1, flags);
if (!(flags->flag & FLAG_LEFTADJUST))
ft_putchar_fd(c, 1);
return (flags->width ? flags->width : 1);
}