•  Back 
  •  GEMDOS Function Reference 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  %About 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The ATARI Compendium
Author      : Scott Sanders / JAY Software
Version     : 1.25 (20/6/2003)
Subject     : Documentation
Nodes       : 1117
Index Size  : 32614
HCP-Version : 6
Compiled on : Atari
@charset    : UTF-8
@lang       : en
@default    : 
@help       : %About
@options    : +g -i -t4 +y +z
@width      : 100
View Ref-FileFwrite()
Fopen()
Fclose()
Fread()                                                              GEMDOS

Syntax

LONG Fread( handle, length, buf )
WORD handle;
LONG length;
VOIDP buf;

Function      Fread() reads binary data from a specified file from the
              current file pointer.

Opcode        63 (0x3F)

Availability  All GEMDOS versions.

Parameters    handle is the GEMDOS file handle of the file to read from.
              length specifies the number of bytes of data to read. buf is
              a pointer to a buffer (at least length bytes long) where the
              read data will be stored.

Binding       pea      buf
              move.l   length,-(sp)
              move.w   handle,-(sp)
              move.w   #$3F,-(sp)
              trap     #1
              lea      12(sp),sp

Return Value  Fread() returns either a positive amount indicating the
              number of bytes actually read (this number may be smaller
              than length if an EOF is hit) or a negative GEMDOS error
              code.

Caveats       Fread() will crash the system if given a parameter of 0 for
              length on GEMDOS versions lower than 0.15.

See Also      Fwrite(), Fopen(), Fclose()