72 lines
2.4 KiB
HTML
72 lines
2.4 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>fread(3)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>fread(3)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
fread, fwrite - buffered binary input/output
|
|
|
|
|
|
</PRE>
|
|
<H2>SYNOPSIS</H2><PRE>
|
|
<STRONG>#include</STRONG> <STRONG><sys/types.h></STRONG>
|
|
<STRONG>#include</STRONG> <STRONG><stdio.h></STRONG>
|
|
|
|
<STRONG>size_t</STRONG> <STRONG>fread(void</STRONG> <STRONG>*</STRONG><EM>ptr</EM><STRONG>,</STRONG> <STRONG>size_t</STRONG> <EM>itemsize</EM><STRONG>,</STRONG> <STRONG>size_t</STRONG> <EM>nitems</EM><STRONG>,</STRONG> <STRONG>FILE</STRONG> <STRONG>*</STRONG><EM>stream</EM><STRONG>)</STRONG>
|
|
<STRONG>size_t</STRONG> <STRONG>fwrite(void</STRONG> <STRONG>*</STRONG><EM>ptr</EM><STRONG>,</STRONG> <STRONG>size_t</STRONG> <EM>itemsize</EM><STRONG>,</STRONG> <STRONG>size_t</STRONG> <EM>nitems</EM><STRONG>,</STRONG> <STRONG>FILE</STRONG> <STRONG>*</STRONG><EM>stream</EM><STRONG>)</STRONG>
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
<STRONG>Fread</STRONG> reads, into a block beginning at <EM>ptr</EM>, <EM>nitems</EM> of data of the type of
|
|
*<EM>ptr</EM> from the named input <EM>stream</EM>. It returns the number of items
|
|
actually read.
|
|
|
|
If <EM>stream</EM> is <STRONG>stdin</STRONG> and the standard output is line buffered, then any
|
|
partial output line will be flushed before any call to <STRONG><A HREF="../man2/read.2.html">read(2)</A></STRONG> to satisfy
|
|
the <STRONG>fread</STRONG>.
|
|
|
|
<STRONG>Fwrite</STRONG> appends at most <EM>nitems</EM> of data of the type of *<EM>ptr</EM> beginning at
|
|
<EM>ptr</EM> to the named output <EM>stream</EM>. It returns the number of items actually
|
|
written.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<STRONG><A HREF="../man2/read.2.html">read(2)</A></STRONG>, <STRONG><A HREF="../man2/write.2.html">write(2)</A></STRONG>, <STRONG><A HREF="../man3/fopen.3.html">fopen(3)</A></STRONG>, <STRONG><A HREF="../man3/getc.3.html">getc(3)</A></STRONG>, <STRONG><A HREF="../man3/putc.3.html">putc(3)</A></STRONG>, <STRONG><A HREF="../man3/gets.3.html">gets(3)</A></STRONG>, <STRONG><A HREF="../man3/puts.3.html">puts(3)</A></STRONG>,
|
|
<STRONG><A HREF="../man3/printf.3.html">printf(3)</A></STRONG>, <STRONG><A HREF="../man3/scanf.3.html">scanf(3)</A></STRONG>.
|
|
|
|
|
|
</PRE>
|
|
<H2>DIAGNOSTICS</H2><PRE>
|
|
<STRONG>Fread</STRONG> and <STRONG>fwrite</STRONG> return 0 upon end of file or error.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|