-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_next_line_utils.c
More file actions
59 lines (53 loc) · 1.46 KB
/
Copy pathget_next_line_utils.c
File metadata and controls
59 lines (53 loc) · 1.46 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: alisharu <marvin@42.fr> #+# +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025-05-11 11:40:49 by alisharu #+# #+# */
/* Updated: 2025-05-11 11:40:49 by alisharu ### ########.fr */
/* */
/* ************************************************************************** */
#include "get_next_line.h"
size_t ft_strlen(char *str)
{
size_t len;
len = 0;
if (!str)
return (0);
while (str[len])
len++;
return (len);
}
char *ft_strjoin(char *line, char *buff)
{
size_t i;
size_t j;
char *str;
i = 0;
j = 0;
str = malloc(sizeof(char) * (ft_strlen(line) + ft_strlen(buff) + 1));
if (str == NULL)
return (NULL);
while (line && line[i])
{
str[i] = line[i];
i++;
}
while (buff[j])
str[i++] = buff[j++];
str[i] = '\0';
free(line);
return (str);
}
char *ft_strchr(char *s, int c)
{
while (*s)
{
if (*s == c)
return (s);
s++;
}
return (NULL);
}