diff options
Diffstat (limited to 'src/io/ft_getfile.c')
| -rw-r--r-- | src/io/ft_getfile.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/io/ft_getfile.c b/src/io/ft_getfile.c new file mode 100644 index 0000000..6ae4833 --- /dev/null +++ b/src/io/ft_getfile.c @@ -0,0 +1,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)); +} |
