diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-01-18 11:54:47 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-02-04 05:33:59 +0100 |
| commit | f078f191515d0fc65340a8722fad14f3de679d7b (patch) | |
| tree | d6881ef24f6cc062332f3aa17709f693cf783b20 /src/io | |
| parent | 014d876b691b5c0e84faa98bd308a855269e4ae4 (diff) | |
| download | libft-f078f191515d0fc65340a8722fad14f3de679d7b.tar.gz libft-f078f191515d0fc65340a8722fad14f3de679d7b.tar.bz2 libft-f078f191515d0fc65340a8722fad14f3de679d7b.zip | |
Added ft_getchar and fixing strtol
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); +} |
