Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
puts.c
Go to the documentation of this file.
1 #include <stdio.h>
2 
3 int puts(const char* str)
4 {
5  int r = 0;
6 
7  for(const char* c = str; *c != 0; c++)
8  {
9  putchar((int)*c);
10  r++;
11  }
12 
13  // puts adds a newline
14  if(r)
15  {
16  putchar('\n');
17  r++;
18  }
19 
20  return r ? r : EOF;
21 }
int putchar(int c)
Requires a definition of _putchar() for your platform.
Definition: putchar.c:4
int puts(const char *str)
Definition: puts.c:3
#define EOF
Definition: stdio.h:23