-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_getchar.c
executable file
·27 lines (23 loc) · 1.04 KB
/
ft_getchar.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_getchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tseguier <tseguier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2013/12/31 02:58:56 by tseguier #+# #+# */
/* Updated: 2014/07/01 19:09:21 by tseguier ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int ft_getchar_fd(int fd)
{
char c;
if (1 != read(fd, &c, 1))
return (-1);
return ((int)c);
}
int ft_getchar(void)
{
return (ft_getchar_fd(0));
}