Improve hexadecimal and pointer by using ltoa instead of itoa

This commit is contained in:
gbaconni
2022-04-15 20:55:58 +02:00
parent 175a774e49
commit d7d3f39e54
8 changed files with 73 additions and 51 deletions

View File

@@ -6,7 +6,7 @@
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/20 11:56:16 by gbaconni #+# #+# */
/* Updated: 2022/04/15 17:12:36 by gbaconni ### lausanne.ch */
/* Updated: 2022/04/15 20:54:31 by gbaconni ### lausanne.ch */
/* */
/* ************************************************************************** */
@@ -29,10 +29,11 @@ int ft_vprintf_pointer(const char *format, va_list ap)
write(1, NIL, len);
return (len);
}
s = ft_itoa_base((unsigned long) p, "0123456789ABCDEF");
s = ft_ltoa_base((long) p, "0123456789abcdef");
len = ft_strlen(s);
write(1, "0x", 2);
write(1, s, len);
ret += len;
ret += len + 2;
free(s);
return (ret);
}