-
Notifications
You must be signed in to change notification settings - Fork 2
/
utils3.c
58 lines (51 loc) · 1.38 KB
/
utils3.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils3.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: abenheni <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/17 19:37:29 by abenheni #+# #+# */
/* Updated: 2023/02/17 19:37:31 by abenheni ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void count_height(char *s, t_long *data)
{
int i;
int fd;
char *line;
fd = open(s, O_RDONLY);
line = get_next_line(fd);
if (line == NULL)
ft_error("error dd\n");
i = 0;
while (line)
{
data->height++;
free(line);
line = get_next_line(fd);
if (!line)
break ;
}
free(line);
close(fd);
}
int ft_strlen1(char *s)
{
int i;
i = 0;
while (s[i])
i++;
return (i);
}
void ft_strcpy(char *dst, char *src)
{
int i;
i = 0;
while (src[i])
{
dst[i] = src[i];
i++;
}
}