Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>fread()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
FREAD()


Syntax:     FREAD(<expN1>, @<memvarC>, <expN2>)

Purpose:    To read characters from a DOS file into a character memory
            variable.

Arguments:  <expN1> is the file handle obtained from FOPEN(),
            FCREATE(), or predefined by DOS.

            <memvarC> is the name of an existing character memory
            variable passed by reference (preface with an @ symbol) to
            use as a buffer.  The length of this memory variable must be
            at least the same as <expN2>.

            <expN2> is the number of bytes to read into the buffer.
            The value returned by a successful FREAD() should be equal
            to <expN2>.

Returns:    An integer numeric value.

            FREAD() returns the number of bytes successfully read.  A
            return value less than <expN2> or zero indicates end-of-file
            or an error.

Usage:      FREAD() reads the file starting at the current DOS file
            pointer position and advances the file pointer by the number
            of bytes read.  Note that FREAD() reads all characters
            including control, null, and high-order (above CHR(127)).

            To reposition the file pointer without reading, use FSEEK().

Library:    EXTEND.LIB

            Warning: These functions allow low level access to DOS
            files and devices.  They should be used with extreme care
            and require a thorough knowledge of the operating system.


----------------------------------- Example --------------------------------

   block  = 128
   buffer = SPACE(512)
   handle = FOPEN("Temp.txt")
   *
   IF FERROR() <> 0
      IF FREAD(handle, @buffer, block) <> block
         ? "Error reading Temp.txt"
      ENDIF
   ENDIF




See Also: FERROR() FREADSTR() FSEEK() FWRITE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson