puts

Writes a specified character string to the output stream and appends a newline character to the output

Local Servers:blocking
Remote Servers:blocking
Classification:ANSI
Platform:NLM
Service:Stream I/O

Syntax

  #include <stdio.h>  
   
  int puts  (  
     const char   *buf);
  

Parameters

buf
(IN) Points to the character string.

Return Values

The puts function returns a nonzero value if an error occurs; otherwise, it returns a value of 0. If an error occurs, errno is set.

Remarks

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 is not written.

See Also

fputs, putc

puts Example

  #include <stdio.h>  
   
  main ()  
  {  
     FILE   *fp;  
     char    buffer[80];  
     fp = freopen ("data.fil", "r", stdin);  
     while (gets (buffer) != NULL)  
        puts (buffer);  
     fclose (fp);  
  }