summaryrefslogtreecommitdiff
path: root/ft_putstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'ft_putstr.c')
-rw-r--r--ft_putstr.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/ft_putstr.c b/ft_putstr.c
new file mode 100644
index 0000000..19a2c37
--- /dev/null
+++ b/ft_putstr.c
@@ -0,0 +1,29 @@
+
+// we use putchar to count each character
+
+#include "ft_printf.h"
+
+int ft_putstr(char *str)
+{
+ int counter;
+ const char *snull = "(null)";
+
+ counter = 0;
+ if (str == NULL)
+ {
+ while (*snull)
+ {
+ counter += ft_putchar(*snull);
+ snull++;
+ }
+ }
+ else
+ {
+ while (*str)
+ {
+ counter += ft_putchar(*str);
+ str++;
+ }
+ }
+ return (counter);
+}