ft_open
This commit is contained in:
parent
e5b5214412
commit
88f211326a
27
ex00/ft_open.c
Normal file
27
ex00/ft_open.c
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_open.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: asargsya <asargsya@student.42yerevan.am> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/12/03 19:08:11 by asargsya #+# #+# */
|
||||||
|
/* Updated: 2023/12/03 19:11:31 by asargsya ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
Reference in New Issue
Block a user