HELPLIB.HLB  —  CRTL  fread
    Reads a specified number of items from the file.

    Format

      #include  <stdio.h>

      size_t fread  (void *ptr, size_t size_of_item, size_t
                    number_items, FILE *file_ptr);

1  –  Arguments

 ptr

    A pointer to the location, within memory, where you place the
    information being read. The type of the object pointed to is
    determined by the type of the item being read.

 size_of_item

    The size of the items being read, in bytes.

 number_items

    The number of items to be read.

 file_ptr

    A pointer that indicates the file from which the items are to be
    read.

2  –  Description

    The type size_t is defined in the header file <stdio.h> as
    follows:

    typedef unsigned int size_t

    The reading begins at the current location in the file. The items
    read are placed in storage beginning at the location given by
    the first argument. You must also specify the size of an item, in
    bytes.

    If the file pointed to by file_ptr was opened in record mode,
    fread will read size_of_item multiplied by number_items bytes
    from the file. That is, it does not necessarily read number_items
    records.

3  –  Return Values

    n                  The number of bytes read divided by size_of_
                       item.
    0                  Indicates the end-of-file or an error.
Close Help