aboutsummaryrefslogtreecommitdiff
path: root/convert_uint.c
diff options
context:
space:
mode:
Diffstat (limited to 'convert_uint.c')
-rw-r--r--convert_uint.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/convert_uint.c b/convert_uint.c
new file mode 100644
index 0000000..bf28679
--- /dev/null
+++ b/convert_uint.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include "header.h"
+
+char *convert_uint(va_list ap, t_pformat *pformat)
+{
+ unsigned int n;
+
+ if (pformat->flags & FLAG_SHORT)
+ n = va_arg(ap, unsigned short);
+ else if (pformat->flags & FLAG_SHORT_SHORT)
+ n = va_arg(ap, unsigned char);
+ else
+ n = va_arg(ap, unsigned int);
+ char *str = ft_itoa_base(n, "0123456789");
+ str = handle_precision(pformat, str);
+ str = handle_padding(pformat, str);
+ return (str);
+}