Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
puts.c File Reference
#include <stdio.h>
Include dependency graph for puts.c:

Go to the source code of this file.

Functions

int puts (const char *str)
 

Function Documentation

◆ puts()

int puts ( const char *  str)

Definition at line 3 of file puts.c.

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
#define EOF
Definition: stdio.h:23

References EOF, and putchar().