Name

fputs

Synopsis

Writes a string to a file

#include <stdio.h>
intfputs( const char * restrict string, FILE * restrict fp );

The fputs() function writes a string to the file specified by the FILE pointer argument. The string is written without the terminator character ('\0'). If successful, fputs() returns a value greater than or equal to zero. A return value of EOF indicates that an error occurred.

Example

See the examples at fclose() and fflush() in this chapter.

See Also

fgets(), fputws()

Get C in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.