fputs -- Write a String to a File

SYNOPSIS

 #include <stdio.h>

 int fputs(const char *str, FILE *f);
 

DESCRIPTION

fputs writes the characters in the string addressed by str to the stream associated with the FILE object addressed by f. Unlike puts, fputs does not write a new-line character after the string.

RETURN VALUE

fputs returns an unspecified value unless an error occurs, in which case it returns EOF.

EXAMPLE

  #include <stdio.h>

  #define LENGTH 80

  char data[LENGTH + 2];

  FILE *ff, *nf;

  main()
  {
        /*  Open FILE1 to read.    */
     ff = fopen("tso:FILE1", "r");

        /* Open NEXTFILE to write. */
     nf = fopen("tso:NEXTFILE", "w");

        /* Read a maximum of 81 characters into the data buffer. */
     while (fgets(data, LENGTH + 2, ff))
        fputs(data, nf);            /* Write data into NEXTFILE. */
  }

 

RELATED FUNCTIONS

puts

SEE ALSO


Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.