view docs/ccguide/fread.refentry @ 2798:b70d93f8d7ce lwtools-port

Updated coco1/modules/makefile and coco3/modules/makefile to help resolve issues with i(x) and s(x) descriptors. Updated level1/coco1/modules/makefile & level2/coco3/modules/makefile so that correct values would be sent to assembler when building superdesc.asm for s(x).dd and i(x).dd descriptors.
author drencor-xeen
date Mon, 28 Jan 2013 16:13:05 -0600
parents a4a6b6315146
children
line wrap: on
line source

<refentry id="fread">
<refnamediv>
<refname>Fread</refname>
<refname>Fwrite</refname>
<refpurpose>read/write binary data</refpurpose>
</refnamediv>

<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>
#include &lt;stdio.h&gt;
</funcsynopsisinfo>
<funcprototype>
  <funcdef><function>fread</function></funcdef>
  <paramdef>char *<parameter>ptr</parameter></paramdef>
  <paramdef>int <parameter>size</parameter></paramdef>
  <paramdef>int <parameter>number</parameter></paramdef>
  <paramdef>FILE *<parameter>fp</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef><function>fwrite</function></funcdef>
  <paramdef>char *<parameter>ptr</parameter></paramdef>
  <paramdef>int <parameter>size</parameter></paramdef>
  <paramdef>int <parameter>number</parameter></paramdef>
  <paramdef>FILE *<parameter>fp</parameter></paramdef>
</funcprototype>
</funcsynopsis>

</refsynopsisdiv>

<refsect1><title>Description</title>
<para>
Fread reads from the file pointed to by "fp". "Number" is the
number of items of size "size" that are to be read starting at
"ptr". The best way to pass the argument "size" to fread is by
using "sizeof". Fread returns the number of items actually
read.
</para>
<para>
Fwrite writes to the file pointed to by "fp". "Number" is the
number of items of size "size" reading the from memory
starting at "ptr".
</para>
</refsect1>
<refsect1><title>Diagnostics</title>
<para>
Both functions return 0 (NULL) at the end of file or error.
</para>
</refsect1>

<refsect1><title>See Also</title>
<para>
System calls
<link linkend="read">read()</link>,
<link linkend="write">write()</link>.
<link linkend="fopen">Fopen()</link>,
<link linkend="getc">getc()</link>,
<link linkend="putc">putc()</link>,
<link linkend="printf">printf()</link>.
</para>
</refsect1>

</refentry>