Next: fputwc, Previous: fputc, Up: Stdio

### 4.21 `fputs`—write a character string in a file or stream

Synopsis

         #include <stdio.h>
         int fputs(const char *restrict s, FILE *restrict fp);

         #include <stdio.h>
         int _fputs_r(struct _reent *ptr, const char *restrict s, FILE *restrict fp);

Description
`fputs` writes the string at s (but without the trailing null) to the file or stream identified by fp.

`_fputs_r` is simply the reentrant version of `fputs` that takes an additional reentrant struct pointer argument: ptr.

Returns
If successful, the result is `0`; otherwise, the result is `EOF`.

Portability
ANSI C requires `fputs`, but does not specify that the result on success must be `0`; any non-negative value is permitted.

Supporting OS subroutines required: `close`, `fstat`, `isatty`, `lseek`, `read`, `sbrk`, `write`.