FWRITE(3POSIX)
π FWRITE(3POSIX) π
okay bestie, welcome to the POSIX Programmer's Manual, section 3POSIX β this is the fwrite page and I'm gonna make it make sense, no cap.
πΈ PROLOG πΈ
This manual page is part of the POSIX Programmer's Manual. Heads up though: the Linux implementation of this interface may differ (so go consult the corresponding Linux manual page for details on Linux behavior), or honestly the interface may not be implemented on Linux at all. Vibe check accordingly. π
β¨ NAME β¨
fwrite β binary output π¦
π SYNOPSIS π
#include <stdio.h>
size_t fwrite(const void *restrict ptr, size_t size, size_t nitems,
FILE *restrict stream);
π DESCRIPTION π
So the functionality described on this reference page is aligned with the ISO C standard. If there's any conflict between the requirements described here and the ISO C standard, that's unintentional, fr fr. This volume of POSIX.1β2017 defers to the ISO C standard. periodt.
The fwrite() function shall write, from the array pointed to by ptr, up to nitems elements whose size is specified by size, to the stream pointed to by stream. For each object, size calls shall be made to the fputc() function, taking the values (in order) from an array of unsigned char exactly overlaying the object. The file-position indicator for the stream (if defined) shall be advanced by the number of bytes successfully written. And if an error occurs, the resulting value of the file-position indicator for the stream is unspecified β so like, don't count on it, bestie. π
The last data modification and last file status change timestamps of the file shall be marked for update between the successful execution of fwrite() and the next successful completion of a call to fflush() or fclose() on the same stream, or a call to exit() or abort(). iconic behavior honestly.
π RETURN VALUE π
The fwrite() function shall return the number of elements successfully written, which may be less than nitems if a write error is encountered. π¬
If size or nitems is 0, fwrite() shall return 0 and the state of the stream remains unchanged β nothing happens, we stay unbothered. β¨
Otherwise, if a write error occurs, the error indicator for the stream shall be set, and errno shall be set to indicate the error.
π₯ ERRORS π₯
Refer to fputc().
The following sections are informative.
π EXAMPLES π
None. (yeah, nothing. the void. π)
π«Ά APPLICATION USAGE π«Ά
Because of possible differences in element length and byte ordering, files written using fwrite() are application-dependent, and possibly cannot be read using fread() by a different application β or by the same application on a different processor. so like, your file is giving "only I understand me" main character energy. π§
β RATIONALE β
None.
π¦ FUTURE DIRECTIONS π¦
None.
π SEE ALSO π
- Section 2.5, Standard I/O Streams
ferror()fopen()fprintf()putc()puts()write()
The Base Definitions volume of POSIX.1β2017, <stdio.h>
πΈ COPYRIGHT πΈ
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page bestie, you ate that π
signing off from the IEEE/The Open Group, 2017 edition β page FWRITE(3POSIX), dated 2017, and this whole thing came to you straight from the POSIX Programmer's Manual. πβ¨
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms