src/pipex.c
/**
 * "Opens" a file by either just opening it or if its meant to be
 * the output, aka stdout, then create it.
 * 
 * @param path The file path to open.
 * @param isoutput Is the file meant to be an output file, aka written to.
 * @return The file descriptor.
 */
"Opens" a file by either just opening it or if its meant to be
the output, aka stdout, then create it.

@param path The file path to open.
@param isoutput Is the file meant to be an output file, aka written to.
@return The file descriptor.
" Opens " a file by either just opening it or if its meant to be the output aka stdout then create it . @param path The file path to open . @param isoutput Is the file meant to be an output file aka written to . @return The file descriptor .
static t_i32	ft_openfile(char *path, t_bool isoutput)
{
	t_i32	fd;
	fd = -1;
	if (isoutput)
	{
		fd = open(path, O_CREAT | O_WRONLY | O_TRUNC, \
		S_IRUSR | S_IWUSR | S_IROTH);
	}
	else
	{
		fd = open(path, O_RDONLY);
	}
	if (fd < 0)
		ft_assert("Unable to open file", EXIT_FAILURE);
	return (fd);
}
static t_i32 ft_openfile ( char * path , t_bool isoutput ) { t_i32 fd ; fd = -1 ; if ( isoutput ) { fd = open ( path , O_CREAT | O_WRONLY | O_TRUNC , S_IRUSR | S_IWUSR | S_IROTH ) ; } else { fd = open ( path , O_RDONLY ) ; } if ( fd < 0 ) ft_assert ( " " , EXIT_FAILURE ) ; return ( fd ) ; }
"Opens" a file by either just opening it or if its meant to be
 the output, aka stdout, then create it.
" Opens " a file by either just opening it or if its meant to be the output aka stdout then create it .