Read characters from a binary file

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


     <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.


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


     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.


     .  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()
           cString := FREADSTR(nHandle, 16)
           ? cString

 Files   Library is CLIPPER.LIB.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.