| ![[Previous]](../image-lib/prev.gif) | ![[Contents]](../image-lib/contents.gif) | ![[Next]](../image-lib/next.gif) | 
write a string to stdout
#include <stdio.h> int puts( const char *buf );
The puts() function writes the character string pointed to by buf to the output stream designated by stdout, and appends a newline character to the output. The terminating null character isn't written.
A nonnegative value (which is the number of characters read, including newlines), or EOF if an error occurs. When an error has occurred, errno indicates the type of error detected.
#include <stdio.h>
void main()
  {
    FILE *fp;
    char buffer[80];
    fp = freopen( "file", "r", stdin );
    while( gets( buffer ) != NULL ) {
      puts( buffer );
    }
    fclose( fp );
  }
ANSI
| Safety: | |
|---|---|
| Interrupt handler | No | 
| Signal handler | No | 
| Thread | Yes | 
errno, ferror(), fopen(), fputc(), fputchar(), fputs(), putc(), putchar()
| ![[Previous]](../image-lib/prev.gif) | ![[Contents]](../image-lib/contents.gif) | ![[Next]](../image-lib/next.gif) |