8999 SMBIOS: cleanup 32-bit specific code
[unleashed.git] / usr / src / man / man3c / fwrite.3c
blobf86ce6bf3f778820f7c2d00e4b0965dcf5f0e3db
1 '\" te
2 .\" Copyright (c) 1997, The Open Group. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" Portions Copyright (c) 2002, Sun Microsystems, Inc.  All Rights Reserved.
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions 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.
8 .\"  This notice shall appear on any product containing this material.
9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 .TH FWRITE 3C "Jul 24, 2002"
13 .SH NAME
14 fwrite \- binary output
15 .SH SYNOPSIS
16 .LP
17 .nf
18 #include <stdio.h>
20 \fBsize_t\fR \fBfwrite\fR(\fBconst void *\fR\fIptr\fR, \fBsize_t\fR \fIsize\fR, \fBsize_t\fR \fInitems\fR, \fBFILE *\fR\fIstream\fR);
21 .fi
23 .SH DESCRIPTION
24 .sp
25 .LP
26 The \fBfwrite()\fR function writes, from the array pointed to by \fIptr\fR, up
27 to \fInitems\fR elements whose size is specified by \fIsize\fR, to the stream
28 pointed to by \fIstream\fR. For each object, \fIsize\fR calls are made to the
29 \fBfputc\fR(3C) function, taking the values (in order) from an array of
30 \fBunsigned char\fR exactly overlaying the object. The file-position indicator
31 for the stream (if defined) is advanced by the number of bytes successfully
32 written. If an error occurs, the resulting value of the file-position indicator
33 for the stream is unspecified.
34 .sp
35 .LP
36 The \fBst_ctime\fR and \fBst_mtime\fR fields of the file will be marked for
37 update between the successful execution of \fBfwrite()\fR and the next
38 successful completion of a call to \fBfflush\fR(3C) or \fBfclose\fR(3C) on the
39 same stream or a call to \fBexit\fR(2) or \fBabort\fR(3C).
40 .SH RETURN VALUES
41 .sp
42 .LP
43 The \fBfwrite()\fR function returns the number of elements successfully
44 written, which might be less than \fInitems\fR if a write error is encountered.
45 If \fIsize\fR or \fInitems\fR is 0, \fBfwrite()\fR returns 0 and the state of
46 the stream remains unchanged. Otherwise, if a write error occurs, the error
47 indicator for the stream is set and \fBerrno\fR is set to indicate the error.
48 .SH ERRORS
49 .sp
50 .LP
51 Refer to \fBfputc\fR(3C).
52 .SH USAGE
53 .sp
54 .LP
55 Because of possible differences in element length and byte ordering, files
56 written using \fBfwrite()\fR are application-dependent, and possibly cannot be
57 read using \fBfread\fR(3C) by a different application or by the same
58 application on a different processor.
59 .SH ATTRIBUTES
60 .sp
61 .LP
62 See \fBattributes\fR(5) for descriptions of the following attributes:
63 .sp
65 .sp
66 .TS
67 box;
68 c | c
69 l | l .
70 ATTRIBUTE TYPE  ATTRIBUTE VALUE
72 Interface Stability     Standard
74 MT-Level        MT-Safe
75 .TE
77 .SH SEE ALSO
78 .sp
79 .LP
80 \fBwrite\fR(2), \fBfclose\fR(3C), \fBferror\fR(3C), \fBfopen\fR(3C),
81 \fBfread\fR(3C), \fBgetc\fR(3C), \fBgets\fR(3C), \fBprintf\fR(3C),
82 \fBputc\fR(3C), \fBputs\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)