aboutsummaryrefslogtreecommitdiff
path: root/include/libft_io.h
blob: faeade4424ba998a0217fd90b21ef8a3fa605557 (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   libft_io.h                                         :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/01/31 10:35:43 by cacharle          #+#    #+#             */
/*   Updated: 2020/05/12 18:00:55 by charles          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#ifndef LIBFT_IO_H
# define LIBFT_IO_H

# include <unistd.h>
# include <stdlib.h>
# include <limits.h>
# include "libft.h"
# include "libft_def.h"

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);

char			ft_getchar(void);

# ifndef FT_GETFILE_BUFFER_SIZE
#  define FT_GETFILE_BUFFER_SIZE 64
# endif

typedef struct	s_ftmem
{
	void		*data;
	size_t		size;
}				t_ftmem;

int				ft_getfile(int fd, t_ftmem *mem);

# ifndef FT_GETLINE_BUFFER_SIZE
#  define FT_GETLINE_BUFFER_SIZE 1
# endif

# define FT_LINE 1
# define FT_EOF 0
# define FT_ERROR -1

/*
** getline.c
*/

int				ft_getline(int fd, char **line);

#endif