write a character string to an output stream
#include <stdio.h> int fputs( const char *buf, FILE *fp );
The fputs() function writes the character string pointed to by buf to the output stream designated by fp. The terminating null character is not written.
The fputs() function returns EOF if an error occurs; otherwise it returns a non-negative value. When an error has occurred, errno contains a value that indicates the type of error that has been detected.
errno, fopen(), fputc(), putc(), puts()
#include <stdio.h> void main() { FILE *fp_in, *fp_out; char buffer[80]; fp_in = fopen( "file", "r" ); fp_out = fopen( "outfile", "w" ); if( fp_in != NULL && fp_out != NULL) { while( fgets( buffer, 80, fp_in ) != NULL ) fputs( buffer, fp_out ); fclose( fp_in ); fclose( fp_out ); } }
ANSI
All (except DOS/PM)