-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf_s.c
More file actions
33 lines (29 loc) · 1.14 KB
/
ft_printf_s.c
File metadata and controls
33 lines (29 loc) · 1.14 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_s.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sabahass <sabahass@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/19 11:16:50 by sabahass #+# #+# */
/* Updated: 2025/10/21 18:58:46 by sabahass ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_print_s(const char *s)
{
int i;
ssize_t w;
if (!s)
s = "(null)";
i = 0;
// ft_strlen(s); // use strlen + write (same as ft_print_d)
while (s[i])
{
w = write(1, &s[i], 1);
if (w != 1)
return (-1);
i++;
}
return (i);
}