-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheck_files.c
33 lines (28 loc) · 1.17 KB
/
check_files.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_files.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mannahri <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/16 02:17:51 by mannahri #+# #+# */
/* Updated: 2022/02/22 11:02:21 by mannahri ### ########.fr */
/* */
/* ************************************************************************** */
#include "pipex.h"
int check_file(char *str)
{
int fd;
fd = open(str, O_RDONLY, 0777);
if (fd < 0)
perror("This file does not exist");
return (fd);
}
int make_file(char *str)
{
int fd;
fd = open(str, O_TRUNC | O_CREAT | O_WRONLY, 0777);
if (fd < 0)
perror("Error creating file");
return (fd);
}