[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
FREAD()
FREAD() reads characters from a DOS file into a character memory
variable.
Syntax
FREAD(<expN1>,@<memvarC>,<expN2>)
Argument
<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 it with the @ 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 starting at the
current DOS pointer location. 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
of 0 indicates end-of-file or an error.
Usage
FREAD() reads the file starting at the current file pointer position.
Note that FREAD() reads all characters including control, null, and
high-order (above CHR(128)).
To reposition the file pointer without reading, use FSEEK().
Example
block = 128
buffer = SPACE(512)
handle = FOPEN("Temp.txt")
*
IF FERROR() <> 0
bytes = FREAD(handle, @buffer, block)
if bytes <> block
? "Error reading Temp.txt"
ENDIF
ENDIF
WARNING: This function allows low level access to DOS files & devices.
They should be used with extreme care and require a thorough
knowledge of the operating system.
See Also:
FCLOSE
FCREATE
FERROR
FOPEN
FREADSTR
FSEEK
FWRITE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson