fputs

Writes a character string to the output stream

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

Syntax

  #include <stdio.h> 
    
  int fputs  (  
     const char   *buf,   
     FILE         *fp);
  

Parameters

buf
(IN) Points to the character string to be written.
fp
(IN) Points to the file

Return Values

If you have linked your program with NWPRE.OBJ, fputs returns the number of character put on success.

If you have linked your program with PRELUDE.OBJ, fputs returns -1 for failure and zero for success.

If an error occurs, errno is set.

Remarks

The fputs function writes the character string pointed to by buf to the file designated by fp. The terminating NULL character is not written.

For backward compatibility with versions of CLIB.NLM previous to version 4.11, applications should link to PRELUDE.OBJ. For ANSI or POSIX compliance, applications should link to NWPRE.OBJ. Applications cannot link to both.

See Also

fopen, fputc, putc, puts

fputs Example

  #include <stdio.h> 
    
  main ()  
  {  
     FILE   *fp;  
     char    buffer [80];  
     fp = fopen ("data.fil", "r");  
     while (fgets (buffer, 80, fp) ) != NULL)  
        fputs (buffer, stdout);  
     fclose (fp);  
  }