fputs, fputs_unlocked—write a character string in a file or streamSynopsis
#include <stdio.h> int fputs(const char *restrict s, FILE *restrict fp); #define _GNU_SOURCE #include <stdio.h> int fputs_unlocked(const char *restrict s, FILE *restrict fp); #include <stdio.h> int _fputs_r(struct _reent *ptr, const char *restrict s, FILE *restrict fp); #include <stdio.h> int _fputs_unlocked_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_unlocked is a non-thread-safe version of fputs.
fputs_unlocked may only safely be used within a scope
protected by flockfile() (or ftrylockfile()) and funlockfile(). This
function may safely be used in a multi-threaded program if and only
if they are called while the invoking thread owns the (FILE *)
object, as is the case after a successful call to the flockfile() or
ftrylockfile() functions. If threads are disabled, then
fputs_unlocked is equivalent to fputs.
_fputs_r and _fputs_unlocked_r are simply reentrant versions of the
above that take 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.
fputs_unlocked is a GNU extension.
Supporting OS subroutines required: close, fstat, isatty,
lseek, read, sbrk, write.