-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_line.c
31 lines (28 loc) · 1.13 KB
/
ft_line.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mavinici <mavinici@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/06/05 18:11:11 by mavinici #+# #+# */
/* Updated: 2021/06/05 18:11:11 by mavinici ### ########.fr */
/* */
/* ************************************************************************** */
#include <libft.h>
char *ft_line(char *s, size_t len)
{
char *line;
size_t i;
line = malloc(len + 1);
if (!line)
return (NULL);
i = 0;
while (i < len)
{
line[i] = s[i];
i++;
}
line[i] = '\0';
return (line);
}