piscine-rush02/ex00/ft_io.c

27 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_io.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/01 08:51:59 by tischmid #+# #+# */
/* Updated: 2023/04/01 08:58:01 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_io.h"
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
int file_exists(char *path)
{
int fd_num_dict = open(path, O_RDONLY, 0);
if (fd_num_dict < 0)
return (0);
if (close(fd_num_dict) < 0)
return (0);
return (1);
}