Example #1
0
char		*ft_wctoa(wchar_t wchar)
{
	char	*str;
	int		j;
	size_t	index;
	wchar_t wc;

	index = 0;
	j = 0;
	if (!(str = ft_get_str(wchar)))
		return (NULL);
	if (wchar)
	{
		wc = wchar;
		while (wc > 0 && ++j)
			wc /= 2;
		if (j <= 7)
			ft_mask1(str, index, wchar);
		else if (j <= 11)
			ft_mask2(str, index, wchar);
		else if (j <= 16)
			ft_mask3(str, index, wchar);
		else
			ft_mask4(str, index, wchar);
	}
	return (str);
}
Example #2
0
int		ft_put_w_char(wchar_t c)
{
	if (c < 256)
		return(ft_putchar(c));
	if (c < 0x07FF)
		return(ft_mask1(c));
	if (c < 0xFFFF)
		return(ft_mask2(c));
	return(ft_mask3(c));
}