blob: 6ae48333e1acf32d747d9c5f5b799233c40881e7 (
plain)
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
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_getfile.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/22 10:32:47 by cacharle #+# #+# */
/* Updated: 2020/08/02 11:01:06 by charles ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft_io.h"
int ft_getfile(char *filename, t_ftmem *mem)
{
int fd;
if ((fd = open(filename, O_RDONLY)) < 0)
return (-1);
if (ft_getfile_fd(fd, mem) < 0)
{
close(fd);
return (-1);
}
return (close(fd));
}
|