logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

setbuf.3p (3021B)


  1. '\" et
  2. .TH SETBUF "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. setbuf
  12. \(em assign buffering to a stream
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <stdio.h>
  17. .P
  18. void setbuf(FILE *restrict \fIstream\fP, char *restrict \fIbuf\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The functionality described on this reference page is aligned with the
  22. ISO\ C standard. Any conflict between the requirements described here and the
  23. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  24. .P
  25. Except that it returns no value, the function call:
  26. .sp
  27. .RS 4
  28. .nf
  29. setbuf(stream, buf)
  30. .fi
  31. .P
  32. .RE
  33. .P
  34. shall be equivalent to:
  35. .sp
  36. .RS 4
  37. .nf
  38. setvbuf(stream, buf, _IOFBF, BUFSIZ)
  39. .fi
  40. .P
  41. .RE
  42. .P
  43. if
  44. .IR buf
  45. is not a null pointer, or to:
  46. .sp
  47. .RS 4
  48. .nf
  49. setvbuf(stream, buf, _IONBF, BUFSIZ)
  50. .fi
  51. .P
  52. .RE
  53. .P
  54. if
  55. .IR buf
  56. is a null pointer.
  57. .SH "RETURN VALUE"
  58. The
  59. \fIsetbuf\fR()
  60. function shall not return a value.
  61. .SH ERRORS
  62. Although the
  63. \fIsetvbuf\fR()
  64. interface may set
  65. .IR errno
  66. in defined ways, the value of
  67. .IR errno
  68. after a call to
  69. \fIsetbuf\fR()
  70. is unspecified.
  71. .LP
  72. .IR "The following sections are informative."
  73. .SH EXAMPLES
  74. None.
  75. .SH "APPLICATION USAGE"
  76. A common source of error is allocating buffer space as an ``automatic''
  77. variable in a code block, and then failing to close the stream in the
  78. same block.
  79. .P
  80. With
  81. \fIsetbuf\fR(),
  82. allocating a buffer of BUFSIZ bytes does not necessarily imply that all
  83. of BUFSIZ bytes are used for the buffer area.
  84. .P
  85. Since
  86. .IR errno
  87. is not required to be unchanged on success, in order to correctly detect
  88. and possibly recover from errors, applications should use
  89. \fIsetvbuf\fR()
  90. instead of
  91. \fIsetbuf\fR().
  92. .SH RATIONALE
  93. None.
  94. .SH "FUTURE DIRECTIONS"
  95. None.
  96. .SH "SEE ALSO"
  97. .IR "Section 2.5" ", " "Standard I/O Streams",
  98. .IR "\fIfopen\fR\^(\|)",
  99. .IR "\fIsetvbuf\fR\^(\|)"
  100. .P
  101. The Base Definitions volume of POSIX.1\(hy2017,
  102. .IR "\fB<stdio.h>\fP"
  103. .\"
  104. .SH COPYRIGHT
  105. Portions of this text are reprinted and reproduced in electronic form
  106. from IEEE Std 1003.1-2017, Standard for Information Technology
  107. -- Portable Operating System Interface (POSIX), The Open Group Base
  108. Specifications Issue 7, 2018 Edition,
  109. Copyright (C) 2018 by the Institute of
  110. Electrical and Electronics Engineers, Inc and The Open Group.
  111. In the event of any discrepancy between this version and the original IEEE and
  112. The Open Group Standard, the original IEEE and The Open Group Standard
  113. is the referee document. The original Standard can be obtained online at
  114. http://www.opengroup.org/unix/online.html .
  115. .PP
  116. Any typographical or formatting errors that appear
  117. in this page are most likely
  118. to have been introduced during the conversion of the source files to
  119. man page format. To report such errors, see
  120. https://www.kernel.org/doc/man-pages/reporting_bugs.html .