-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_char_conversions.c
32 lines (29 loc) · 1.21 KB
/
ft_char_conversions.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_char_conversions.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mcosta-d <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/27 22:29:02 by mcosta-d #+# #+# */
/* Updated: 2023/06/27 22:29:05 by mcosta-d ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
/*1. Char conversion - %c - prints a single character*/
void ft_putchar(char c, int *i)
{
*i += write(1, &c, 1);
}
/*2. String conversion - %s - Prints a string
(as defined by the common C convention)*/
void ft_putstr(char *str, int *i)
{
if (!str)
str = "(null)";
while (*str)
{
*i += write(1, str, 1);
str++;
}
}