diff options
Diffstat (limited to 'src/io')
| -rw-r--r-- | src/io/ft_getchar.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/io/ft_getchar.c b/src/io/ft_getchar.c new file mode 100644 index 0000000..54b44d4 --- /dev/null +++ b/src/io/ft_getchar.c @@ -0,0 +1,22 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_getchar.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/18 10:29:54 by cacharle #+# #+# */ +/* Updated: 2020/01/18 10:46:56 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +char ft_getchar(void) +{ + char c; + + if (read(STDIN_FILENO, &c, 1) < 0) + return (-1); + return (c); +} |
