-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_put_str.c
35 lines (32 loc) · 1.25 KB
/
ft_put_str.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_put_str.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: chris <chris@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/10 19:11:11 by chris #+# #+# */
/* Updated: 2023/01/13 14:42:52 by chris ### ########.fr */
/* */
/* ************************************************************************** */
// This function ft_put_str prints a string and increasing a print counter by
// the amount of printed chars.
// Return: None.
#include "ft_printf.h"
void ft_put_str(const char *str, size_t *cnt_out)
{
if (str == NULL)
{
write(1, "(null)", 6);
*cnt_out = *cnt_out + 6;
}
else
{
while (*str != '\0')
{
write(1, str, 1);
*cnt_out = *cnt_out + 1;
str++;
}
}
}