fputs function(Write String from File) in C Language – example and detail

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


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

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

Parameters or Arguments

s The string to write to the stream. stream The movement to write to.


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

Required Header

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

#include <stdio.h>

Applies To

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

ANSI/ISO 9899-1990

Similar Functions

Other C features that are similar to the fputs function:

puts function <stdio.h>

See Also

Other C functions that are noteworthy when dealing with the fputs function:

fgets function <stdio.h>

gets function <stdio.h>