[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FREADSTR()
 Read characters from a binary file
------------------------------------------------------------------------------
 Syntax

     FREADSTR(<nHandle>, <nBytes>) --> cString

 Arguments

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

     <nBytes> is the number of bytes to read, beginning at the current
     DOS file pointer position.

 Returns

     FREADSTR() returns a character string up to 65,535 (64K) bytes.  A null
     return value ("") indicates an error or end of file.

 Description

     FREADSTR() is a low-level file function that reads characters from an
     open binary file beginning with the current DOS file pointer position.
     Characters are read up to <nBytes> or until a null character (CHR(0)) is
     encountered.  All characters are read including control characters
     except for CHR(0).  The file pointer is then moved forward <nBytes>.  If
     <nBytes> is greater than the number of bytes from the pointer position
     to the end of the file, the file pointer is positioned to the last byte
     in the file.

     Warning!  This function allows low-level access to DOS files and
     devices.  It should be used with extreme care and requires a thorough
     knowledge of the operating system.

 Examples

     .  This example displays the ASCII values of the first 16 bytes
        of a text file:

        #include "Fileio.ch"
        //
        nHandle := FOPEN("New.txt", FC_NORMAL)
        IF FERROR() != 0
           ? "File open error:", FERROR()
        ELSE
           cString := FREADSTR(nHandle, 16)
           ? cString
           FCLOSE(nHandle)
        ENDIF

 Files   Library is CLIPPER.LIB.


See Also: BIN2I() BIN2L() BIN2W() FERROR() FOPEN() FREAD()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson