コード例 #1
0
ファイル: ft_algo.c プロジェクト: amineau/ft_printf
int		ft_form2(t_format *tmp, va_list ap)
{
	if (tmp->type == 's')
		return (ft_string(tmp, ap));
	else if (tmp->type == 'C' || (tmp->type == 'c' &&
				ft_strcmp(tmp->lenght, "l") == 0))
		return (ft_wint(tmp, ap));
	else if (tmp->type == 'c')
		return (ft_char(tmp, ap));
	else if (tmp->type == 'd' || tmp->type == 'i' || tmp->type == 'D')
		return (ft_int(tmp, ap));
	else if (tmp->type == 'f' || tmp->type == 'F')
		return (ft_float(tmp, ap));
	else if (tmp->type == 'u' || tmp->type == 'U')
		return (ft_unint(tmp, ap));
	else if (tmp->type == 'o' || tmp->type == 'O')
		return (ft_octal(tmp, ap));
	else if (tmp->type == 'b' || tmp->type == 'B')
		return (ft_binaire(tmp, ap));
	else if (tmp->type == 'e' || tmp->type == 'E')
		return (ft_scienti(tmp, ap));
	else if (tmp->type == 'x' || tmp->type == 'X')
		return (ft_hexa(tmp, ap));
	else if (tmp->type == 'p')
		return (ft_adrpoint(tmp, ap));
	else
		return (ft_char(tmp, ap));
}
コード例 #2
0
ファイル: ft_print_comb.c プロジェクト: EpicWAX/Piscine-C
void	ft_print_comb(void)
{
	char	tab[3];

	tab[0] = '0';
	tab[1] = '1';
	tab[2] = '2';
	while (tab[0] <= '7')
	{
		tab[1] = tab[0] + 1;
		while (tab[1] <= '8')
		{
			tab[2] = tab[1] + 1;
			while (tab[2] <= '9')
			{
				ft_char(tab[0], tab[1], tab[2]);
				if (tab[0] != '7' || tab[1] != '8' || tab[2] != '9')
					ft_space();
				tab[2]++;
			}
			tab[1]++;
		}
		tab[0]++;
	}
}
コード例 #3
0
ファイル: ft_format.c プロジェクト: sethquantix/school42
char			*ft_get(va_list va, t_format *opt)
{
	char	*buff;

	buff = NULL;
	if ((opt->type & 0xf0) == 0 || (opt->type & 0xff) == (HEX_V + UPPER))
		buff = ft_decimal(va, opt);
	if (opt->type & CHARV)
		buff = ft_char(va, opt);
	if ((opt->type & 0xff) == STR_V)
		buff = ft_str(va, opt);
	if ((opt->type & 0xff) == PTR_V)
		buff = ft_ptr(va, opt);
	if ((opt->type & 0xff) == INTAB)
		buff = ft_intab(va, opt);
	return (buff);
}
コード例 #4
0
int	ft_str_is_alpha(char *str)
{
	int	i;
	int size_str;

	i = 0;
	size_str = 0;
	while (str[size_str] != '\0')
		size_str++;
	if (size_str == 0)
		return (1);
	while (str[i])
	{
		if (!(ft_char(str[i])))
			return (0);
		i++;
	}
	return (1);
}