aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-10-25 04:42:08 +0200
committerCharles <sircharlesaze@gmail.com>2019-10-25 04:42:08 +0200
commitfeb71e200972bb78fe86130629ef040ef80811a7 (patch)
tree24b84b3f4937ab4eb930e1ad851494d8d49a9775 /main.c
parent1b4df01bfa793fe91a58192a4b79917909bf1614 (diff)
downloadft_printf-feb71e200972bb78fe86130629ef040ef80811a7.tar.gz
ft_printf-feb71e200972bb78fe86130629ef040ef80811a7.tar.bz2
ft_printf-feb71e200972bb78fe86130629ef040ef80811a7.zip
WIP: Added libft submodule, make ft_printf lib
Diffstat (limited to 'main.c')
-rw-r--r--main.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..54944d5
--- /dev/null
+++ b/main.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include "libft.h"
+#include "header.h"
+
+int main()
+{
+ int test;
+
+ printf("bonjour");
+ ft_printf("char: %c\n", 'r');
+ ft_printf("string: %s\n", "bonjour");
+ ft_printf("pointer: %p\n", &test);
+ ft_printf("int: %d or %i\n", 45, 54);
+ ft_printf("uint: %u\n", 1 << 31);
+ ft_printf("hex lower: %x\n", 0xabcf012);
+ ft_printf("hex upper: %X\n", 0xabcf012);
+ ft_printf("percent: %%\n");
+
+ ft_printf("precision |%.9d|\n", 43);
+ ft_printf("string precision |%.9s|\n", "jesuisbonjourbonjour");
+ ft_printf("min width |%9d|\n", 43);
+ ft_printf("zero padding |%09d|\n", 43);
+ ft_printf("left adjusted |%-9d|\n", 43);
+ ft_printf("string padding |%9s|\n", "bon");
+
+ ft_printf("width wildcard |%*d|\n", 5, 43);
+ ft_printf("precision wildcard |%.*d|\n", 5, 43);
+ ft_printf("precision/width wildcard |%*.*d|\n", 5, 3, 43);
+ ft_printf("left adjusted |%*d|\n", -5, 43);
+
+ /* ft_printf("overwrite |%*3d|\n", 5, 43); */
+ /* ft_printf("overwrite |%*-1d|\n", 0, 43); */
+ return 0;
+}