-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint_str.c
31 lines (28 loc) · 1.15 KB
/
print_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_str.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fschuber <fschuber@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/16 08:33:26 by fschuber #+# #+# */
/* Updated: 2023/10/19 08:50:56 by fschuber ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int print_str(char *str)
{
int counter;
char temp_char;
counter = 0;
if (!str)
return (print_str("(null)"));
while (str[counter])
{
temp_char = (char)str[counter];
if (write(1, &temp_char, 1) == -1)
return (-1);
counter++;
}
return (counter);
}