-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_putchar_fd.c
More file actions
27 lines (24 loc) · 1.1 KB
/
Copy pathft_putchar_fd.c
File metadata and controls
27 lines (24 loc) · 1.1 KB
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_putchar_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gfoote <gfoote@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/05 15:18:21 by gfoote #+# #+# */
/* Updated: 2019/04/08 15:07:07 by gfoote ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putchar_fd(char c, int fd)
{
unsigned char ch[2];
if (c >= 0)
write(fd, &c, 1);
else
{
ch[0] = (3 << 6) + ((unsigned char)c >> 6);
ch[1] = (1 << 7) + ((unsigned char)c & 63);
write(fd, ch, 2);
}
}