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

fwrite.3p (3716B)


  1. '\" et
  2. .TH FWRITE "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. fwrite
  12. \(em binary output
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <stdio.h>
  17. .P
  18. size_t fwrite(const void *restrict \fIptr\fP, size_t \fIsize\fP, size_t \fInitems\fP,
  19. FILE *restrict \fIstream\fP);
  20. .fi
  21. .SH DESCRIPTION
  22. The functionality described on this reference page is aligned with the
  23. ISO\ C standard. Any conflict between the requirements described here and the
  24. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  25. .P
  26. The
  27. \fIfwrite\fR()
  28. function shall write, from the array pointed to by
  29. .IR ptr ,
  30. up to
  31. .IR nitems
  32. elements whose size is specified by
  33. .IR size ,
  34. to the stream pointed to by
  35. .IR stream .
  36. For each object,
  37. .IR size
  38. calls shall be made to the
  39. \fIfputc\fR()
  40. function, taking the values (in order) from an array of
  41. .BR "unsigned char"
  42. exactly overlaying the object. The file-position indicator for the
  43. stream (if defined) shall be advanced by the number of bytes
  44. successfully written. If an error occurs, the resulting value of the
  45. file-position indicator for the stream is unspecified.
  46. .P
  47. The last data modification and last file status change timestamps
  48. of the file shall be marked for update between the successful
  49. execution of
  50. \fIfwrite\fR()
  51. and the next successful completion of a call to
  52. \fIfflush\fR()
  53. or
  54. \fIfclose\fR()
  55. on the same stream, or a call to
  56. \fIexit\fR()
  57. or
  58. \fIabort\fR().
  59. .SH "RETURN VALUE"
  60. The
  61. \fIfwrite\fR()
  62. function shall return the number of elements successfully written,
  63. which may be less than
  64. .IR nitems
  65. if a write error is encountered. If
  66. .IR size
  67. or
  68. .IR nitems
  69. is 0,
  70. \fIfwrite\fR()
  71. shall return 0 and the state of the stream remains unchanged. Otherwise,
  72. if a write error occurs, the error indicator for the stream shall be set,
  73. and
  74. .IR errno
  75. shall be set to indicate the error.
  76. .SH ERRORS
  77. Refer to
  78. .IR "\fIfputc\fR\^(\|)".
  79. .LP
  80. .IR "The following sections are informative."
  81. .SH EXAMPLES
  82. None.
  83. .SH "APPLICATION USAGE"
  84. Because of possible differences in element length and byte ordering,
  85. files written using
  86. \fIfwrite\fR()
  87. are application-dependent, and possibly cannot be read using
  88. \fIfread\fR()
  89. by a different application or by the same application on a different
  90. processor.
  91. .SH RATIONALE
  92. None.
  93. .SH "FUTURE DIRECTIONS"
  94. None.
  95. .SH "SEE ALSO"
  96. .IR "Section 2.5" ", " "Standard I/O Streams",
  97. .IR "\fIferror\fR\^(\|)",
  98. .IR "\fIfopen\fR\^(\|)",
  99. .IR "\fIfprintf\fR\^(\|)",
  100. .IR "\fIputc\fR\^(\|)",
  101. .IR "\fIputs\fR\^(\|)",
  102. .IR "\fIwrite\fR\^(\|)"
  103. .P
  104. The Base Definitions volume of POSIX.1\(hy2017,
  105. .IR "\fB<stdio.h>\fP"
  106. .\"
  107. .SH COPYRIGHT
  108. Portions of this text are reprinted and reproduced in electronic form
  109. from IEEE Std 1003.1-2017, Standard for Information Technology
  110. -- Portable Operating System Interface (POSIX), The Open Group Base
  111. Specifications Issue 7, 2018 Edition,
  112. Copyright (C) 2018 by the Institute of
  113. Electrical and Electronics Engineers, Inc and The Open Group.
  114. In the event of any discrepancy between this version and the original IEEE and
  115. The Open Group Standard, the original IEEE and The Open Group Standard
  116. is the referee document. The original Standard can be obtained online at
  117. http://www.opengroup.org/unix/online.html .
  118. .PP
  119. Any typographical or formatting errors that appear
  120. in this page are most likely
  121. to have been introduced during the conversion of the source files to
  122. man page format. To report such errors, see
  123. https://www.kernel.org/doc/man-pages/reporting_bugs.html .