void ft_conv_d(long long k, t_struct *details) { int pad; unsigned long long d; if (details->precision != -1) details->zero = 0; if (k < 0) { details->sign = 1; d = ~k + 1; } else d = (unsigned long long)k; pad = ft_count_int(d, details, 0); if (details->precision != -1) pad = ft_count_digit(pad, details, 1); ft_printf_int(d, details, 1, pad); if (details->minus) ft_printf_pad(details, pad); }
char *ft_itoa(int n) { char *str; int len; len = ft_count_int(n); str = (char *)malloc((len + 1) * (sizeof(char))); if (str == 0) return (NULL); if (n == -2147483648) { str = ft_strdup("-2147483648"); return (str); } if (n < 0) str = ft_n_is_neg(str, n, len); if (n >= 0) str = ft_n_is_pos(str, n, len); str[len] = '\0'; return (str); }