-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspace_or_zero.c
28 lines (25 loc) · 1.08 KB
/
space_or_zero.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* space_or_zero.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jfreitas <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/27 13:24:25 by jfreitas #+# #+# */
/* Updated: 2020/02/24 14:30:12 by jfreitas ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int space_or_zero(char c, int len)
{
char *str;
if (len > 0)
{
if (!(str = ft_strnew(len)))
return (-1);
ft_memset(str, c, len);
write(1, str, len);
free(str);
}
return (0);
}