-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_getchar_fd.c
24 lines (21 loc) · 1018 Bytes
/
ft_getchar_fd.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_getchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: <> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/08/02 12:14:04 by #+# #+# */
/* Updated: 2016/08/16 12:25:04 by ### ########.fr */
/* */
/* ************************************************************************** */
#include "21sh.h"
int ft_getchar_fd(int fd)
{
char c;
if (1 != read(fd, &c, 1))
{
return (-1);
}
return ((int)c);
}