aboutsummaryrefslogtreecommitdiff
path: root/src/io/ft_getfile.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-08-02 11:05:33 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-08-02 11:05:33 +0200
commit5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde (patch)
tree80911dc3c32e9f230750e7e1042d413dfb6efab2 /src/io/ft_getfile.c
parentee32953ea79616e72f5428cdf40c834714a891c9 (diff)
parentb96b82194ccad2cddbb46b77aa1962a57c47ff44 (diff)
downloadlibft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.tar.gz
libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.tar.bz2
libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.zip
Merge branch 'master' into ft_ssl
Diffstat (limited to 'src/io/ft_getfile.c')
-rw-r--r--src/io/ft_getfile.c27
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));
+}