Older Newer
Wed, 24 May 2017 05:06:25 . . . . SyneRyder [Should link to fwrite, not back to itself]


Changes by last author:

Added:
= fread =

== Syntax ==

:int fread(void* buffer, int size, int numitems, void* file)

== Arguments ==

:buffer

::A pointer to the data buffer where the data read from the file will be stored.

:size

::The size of the data blocks you want to read from the file (eg if reading 32-bit integers, you might set this to 4 bytes).

:numitems

::The number of blocks of data you want to read from the file (eg number of integers you want to read from the file in a row).

:file

::The pointer/handle to the already opened file you want to read from.

== Return ==

:Returns the number of items that were successfully read from the file.

== Description ==

:Reads data from a previously opened file or stream.

== Example ==

== Also see ==

:fopen, fwrite, fclose

== Comments ==

* The size and numitems parameters can be confusing - it's often easier to set the size parameter to the number of bytes you want to read from the file, and keep the numitems parameter set to 1.