From 88f211326a5b089e2b49da09436a6dc8ef850f1d Mon Sep 17 00:00:00 2001 From: Anahit Sargsyan Date: Sun, 3 Dec 2023 19:11:58 +0400 Subject: [PATCH] ft_open --- ex00/ft_open.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ex00/ft_open.c diff --git a/ex00/ft_open.c b/ex00/ft_open.c new file mode 100644 index 0000000..0cd3f3e --- /dev/null +++ b/ex00/ft_open.c @@ -0,0 +1,27 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_open.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: asargsya +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/12/03 19:08:11 by asargsya #+# #+# */ +/* Updated: 2023/12/03 19:11:31 by asargsya ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include + +void ft_open(char *path) +{ + int fd; + char buf[1024]; + int buflen; + + fd = open(&path, O_RDONLY); + while ((buflen == read(fd, buf, 1024)) > 0) + { + write(1, buf, buflen); + } + close(fd); +}