From 676b37f963789f3d85b18ed5b3708374971b65e2 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 18 Jan 2020 11:54:47 +0100 Subject: Added ft_getchar and fixing strtol --- src/io/ft_getchar.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/io/ft_getchar.c (limited to 'src/io') 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 +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* 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); +} -- cgit