C Language: fputs function(Write String from File)

In the C Programming Language, the fputs function writes a string to the stream pointed to by stream.


The syntax for the fputs function in the C Language is:

int fputs(const char *s, FILE *stream);

Parameters or Arguments


The string to write to the stream.


The stream to write to.


The fputs function a nonnegative value if it is successful. The fputs function will return an EOF if an error occurs while trying to write to the stream.

Required Header

In the C Language, the required header for the fputs function is:

#include <stdio.h>

Applies To

In the C Language, the fputs function can be used in the following versions:

  • ANSI/ISO 9899-1990

stdio.h Functions