-
Notifications
You must be signed in to change notification settings - Fork 0
/
char.c
37 lines (34 loc) · 1.3 KB
/
char.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
36
37
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* char.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moboustt <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/29 13:56:07 by moboustt #+# #+# */
/* Updated: 2019/12/15 21:29:39 by moboustt ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void is_char(t_struct *list, va_list ap)
{
int out_char;
out_char = (int)va_arg(ap, int);
if (list->width == -1)
list->n += write(1, &out_char, 1);
else
{
if (list->minus == 1)
{
list->n += write(1, &out_char, 1);
while (list->width-- > 1)
list->n += write(1, " ", 1);
}
else
{
while (list->width-- > 1)
list->n += write(1, " ", 1);
list->n += write(1, &out_char, 1);
}
}
}