-
Notifications
You must be signed in to change notification settings - Fork 0
putchar
Augustin LOPEZ edited this page Sep 6, 2019
·
3 revisions
The version implemented in this libft is not the one from the libft PDF subject:
#include "libft.h"
ssize_t ft_putchar_fd(unsigned int c, int fd);
- The ft_putchar_fd() function shall outputs the unicode character c to the file descriptor fd in UTF-8 format.
- Upon successful completion, ft_putchar_fd() shall return the number of bytes actually written to the file associated with fd. This number shall be between 0 and 4 bytes. Otherwise, -1 shall be returned and errno set to indicate the error.
The following calls are equivalent.
ft_putchar(c);
ft_putchar_fd(c, STDOUT_FILENO);
Beside the different prototype, this implementation introduces several non-requested behaviors:
- The return value of write() is returned.
- If c is an unicode code point (instead of an ASCII character), the character is written in UTF-8
Back to the repository.