[Previous]
[Contents]
[Next]

puts()

write a string to stdout

Synopsis:

#include <stdio.h>

int puts( const char *buf );

Description:

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.

Returns:

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.

Examples:

#include <stdio.h>

void main()
  {
    FILE *fp;
    char buffer[80];

    fp = freopen( "file", "r", stdin );
    while( gets( buffer ) != NULL ) {
      puts( buffer );
    }
    fclose( fp );
  }

Classification:

ANSI

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

errno, ferror(), fopen(), fputc(), fputchar(), fputs(), putc(), putchar()


[Previous]
[Contents]
[Next]