carta
fputs_unlocked(3)

fputs_unlocked3

Output a line to a stream

Part of fputs(3).

Usage

int

int

int

Library

Standard C Library (libc, -lc)

Overview

The function fputs() writes the string pointed to by str to the stream pointed to by stream.

The fputs_unlocked() function is equivalent to fputs(), except that the caller is responsible for locking the stream with flockfile(3) before calling it. This function may be used to avoid the overhead of locking the stream and to prevent races when multiple threads are operating on the same stream.

The function puts() writes the string str, and a terminating newline character, to the stream stdout.

Return values

The functions fputs() and puts() return a nonnegative integer on success and EOF on error.

Errors

[EBADF]

The stream argument is not a writable stream.

The functions fputs() and puts() may also fail and set errno for any of the errors specified for the routines write(2).

History

  • FreeBSD 16.0-CURRENT (2026-10-27) to FreeBSD 15.0-RELEASE: the text shown here
  • FreeBSD 14.5-RELEASE to FreeBSD 13.3-RELEASE
  • FreeBSD 13.2-RELEASE to FreeBSD 13.0-RELEASE
  • FreeBSD 12.4-RELEASE
  • FreeBSD 12.3-RELEASE
  • FreeBSD 12.2-RELEASE
  • FreeBSD 11.4-RELEASE

Standards

The functions fputs() and puts() conform to ISO/IEC 9899:1990 (“ISO C90”).

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.