-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_print_char.c
35 lines (30 loc) · 1.25 KB
/
ft_print_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_char.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gantonio <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/07/05 22:52:23 by gantonio #+# #+# */
/* Updated: 2021/07/17 19:26:31 by gantonio ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_print_char(char c, int width)
{
int counter;
counter = 1;
counter += ft_print_width(width, 1);
ft_putchar(c);
return (counter);
}
int ft_print_string(char *str, int width)
{
int counter;
counter = ft_strlen(str);
if (!str)
return (write(1, "(null)", 6), 6);
counter += ft_print_width(width, counter);
ft_putstr_fd(str, 1);
return (counter);
}