Exemplo n.º 1
0
Arquivo: l.c Projeto: gygy19/new_libft
char		*flag_ul(t_string *string, short base)
{
	unsigned long int	tmp;

	tmp = get_ulong_int(string);
	string->is_negative = 0;
	if (base == 8)
		return (ft_uitoabase(tmp, "01234567"));
	else if (base == 10)
		return (ft_uitoa(tmp));
	else if (base == 16)
		return (ft_uitoabase(tmp, "0123456789abcdef"));
	else if (base == 32)
		return (ft_uitoabase(tmp, "0123456789ABCDEF"));
	return (NULL);
}
Exemplo n.º 2
0
int				flag_u(t_string *string, int i)
{
	if (!ft_strncmp(string->converter.type, "ll", 2))
		conv_ll(string, get_ulong_long_int(string));
	else if (!ft_strncmp(string->converter.type, "l", 1))
		conv_l(string, get_ulong_int(string));
	else if (!ft_strncmp(string->converter.type, "hh", 2))
		conv_hh(string, (unsigned char)get_uint(string));
	else if (!ft_strncmp(string->converter.type, "h", 1))
		conv_h(string, get_ushort(string));
	else if (!ft_strncmp(string->converter.type, "z", 1))
		conv_z(string, get_size_t(string));
	else if (!ft_strncmp(string->converter.type, "j", 1))
		conv_j(string, get_intmax_t(string));
	else
		conv_default(string, get_uint(string));
	return (i + 1);
}