-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.c
59 lines (52 loc) · 1.47 KB
/
utils.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
59
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tyassine <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/06/29 19:00:29 by tyassine #+# #+# */
/* Updated: 2016/06/29 19:00:34 by tyassine ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
int len_tab(int fd)
{
char *buff;
int ret;
int size;
buff = (char *)ft_strnew(200);
size = 0;
while ((ret = read(fd, buff, 200)) > 0)
{
size += ret;
}
close(fd);
free(buff);
return (size);
}
int check_type_file(char *str, char *type)
{
while ((*str) != '\0')
{
if (*str == '.' && ft_strequ(str + 1, type) == 1)
{
return (1);
}
str++;
}
return (0);
}
int count_map_length(char **str)
{
int count;
count = 0;
while (str[count] != NULL)
count++;
return (count);
}
void erase(t_win *win)
{
ft_bzero(win->data, WIN_H * WIN_W * 4);
expose_hook(win);
}