diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-08-02 11:05:33 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-08-02 11:05:33 +0200 |
| commit | 5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde (patch) | |
| tree | 80911dc3c32e9f230750e7e1042d413dfb6efab2 /include/libft_io.h | |
| parent | ee32953ea79616e72f5428cdf40c834714a891c9 (diff) | |
| parent | b96b82194ccad2cddbb46b77aa1962a57c47ff44 (diff) | |
| download | libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.tar.gz libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.tar.bz2 libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.zip | |
Merge branch 'master' into ft_ssl
Diffstat (limited to 'include/libft_io.h')
| -rw-r--r-- | include/libft_io.h | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/include/libft_io.h b/include/libft_io.h index 869bb86..f0d6f49 100644 --- a/include/libft_io.h +++ b/include/libft_io.h @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:35:43 by cacharle #+# #+# */ -/* Updated: 2020/02/22 10:36:44 by cacharle ### ########.fr */ +/* Updated: 2020/08/02 11:03:44 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,42 +18,52 @@ # include <fcntl.h> # include <limits.h> # include "libft.h" +# include "libft_def.h" -/* -** output -*/ +void ft_putendl(char *s); +void ft_putchar(char c); +void ft_putstr(char const *s); +void ft_putnbr(int n); +void ft_putnbr_base(int n, char *base); +void ft_putchar_fd(char c, int fd); +void ft_putstr_fd(char *s, int fd); +void ft_putendl_fd(char *s, int fd); +void ft_putnbr_fd(int n, int fd); +void ft_putnbr_base_fd(int n, char *base, int fd); -void ft_putendl(char *s); -void ft_putchar(char c); -void ft_putstr(char const *s); -void ft_putnbr(int n); -void ft_putchar_fd(char c, int fd); -void ft_putstr_fd(char *s, int fd); -void ft_putendl_fd(char *s, int fd); -void ft_putnbr_fd(int n, int fd); -void ft_putnbr_base(int n, char *base); -void ft_putnbr_base_fd(int n, char *base, int fd); +char ft_getchar(void); -/* -** input -*/ +# ifndef FT_GETFILE_BUFFER_SIZE +# define FT_GETFILE_BUFFER_SIZE 64 +# endif +# if FT_GETFILE_BUFFER_SIZE <= 0 +# error "FT_GETFILE_BUFFER_SIZE must be > 0" +# endif -char ft_getchar(void); -char *ft_read_fd(int fd); -char *ft_read_file(char *filename); +typedef struct s_ftmem +{ + void *data; + size_t size; +} t_ftmem; -# ifndef FTNL_BUFFER_SIZE -# define FTNL_BUFFER_SIZE 32 +int ft_getfile_fd(int fd, t_ftmem *mem); +int ft_getfile(char *filename, t_ftmem *mem); + +# ifndef FT_GETLINE_BUFFER_SIZE +# define FT_GETLINE_BUFFER_SIZE 64 +# endif +# if FT_GETLINE_BUFFER_SIZE <= 0 +# error "FT_GETLINE_BUFFER_SIZE must be > 0" # endif -# define FTNL_STATUS_LINE 1 -# define FTNL_STATUS_EOF 0 -# define FTNL_STATUS_ERROR -1 +# define FT_LINE 1 +# define FT_EOF 0 +# define FT_ERROR -1 /* -** get_next_line.c +** getline.c */ -int ft_next_line(int fd, char **line); +int ft_getline(int fd, char **line); #endif |
