Exemple #1
0
int				print_wstring(t_tag *tag, wchar_t *str)
{
	int			str_len;

	str_len = tag->has_precision ? ft_strnwlen(str, tag->precision) :
										ft_strwlen(str);
	if (tag->has_width && !tag->flag_minus)
		print_width_pad(str_len, tag->width, tag->flag_zero ?
			'0' : ' ');
	ft_putnwstr(str, str_len);
	if (tag->has_width && tag->flag_minus)
		print_width_pad(str_len, tag->width, ' ');
	return (tag->has_width ? ft_max(tag->width, str_len) : str_len);
}
void			call_putwstr(t_data *data)
{
	int			*str;
	t_specify	*spec;

	spec = &data->spec;
	str = va_arg(*data->ap, int *);
	if (!str)
		str = L"(null)";
	data->spec.nb_len = ft_strwlen(str);
	if (spec->dot == true && spec->dot_value < spec->nb_len)
		spec->nb_len = ft_strnwlen(str, spec->dot_value);
	before_printing_s(data, &data->spec);
	data->ret += ft_putnwstr(str, spec->nb_len);
	after_printing_s(data, &data->spec);
}