-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putnstr.c
35 lines (32 loc) · 1.18 KB
/
ft_putnstr.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_putnstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dalves-p <dalves-p@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/05/18 21:22:49 by dalves-p #+# #+# */
/* Updated: 2021/08/19 10:59:02 by dalves-p ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** LIBRARY: N/A
** DESCRIPTION:
** The ft_putstr() function outputs the string ’s’ to the standard output
** limited to n chars.
*/
void ft_putnstr(char *s, int n)
{
if (!s)
ft_putnstr("(null)", n);
else
{
while (*s && n > 0)
{
write(1, s, 1);
s++;
n--;
}
}
}