-
Notifications
You must be signed in to change notification settings - Fork 0
/
print_chars.c
36 lines (33 loc) · 1.35 KB
/
print_chars.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_chars.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: alex <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/01/13 17:54:13 by alex #+# #+# */
/* Updated: 2021/01/13 17:54:53 by alex ### ########.fr */
/* */
/* ************************************************************************** */
#include "printfhead.h"
void ft_order_to_print_char(int pos, t_struct *blocks)
{
char w_ch;
char printed;
printed = pos;
w_ch = ' ';
if (blocks->f_zero && !blocks->f_minus)
w_ch = '0';
if (blocks->f_minus)
{
blocks->total_printed += write(1, &printed, 1);
while (blocks->width-- > 1)
blocks->total_printed += write(1, &w_ch, 1);
}
else
{
while (blocks->width-- > 1)
blocks->total_printed += write(1, &w_ch, 1);
blocks->total_printed += write(1, &printed, 1);
}
}