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>freadstr()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
FREADSTR()


Syntax:     FREADSTR(<expN1>, <expN2>)

Purpose:    To read characters from a file.

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

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

Returns:    A character string.

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

Usage:      FREADSTR() reads from the current DOS file pointer position,
            the number of characters specified by <expN2> or until a
            null character (CHR(0)) is encountered advancing the file
            pointer by the number of bytes read.  All characters are
            read including control characters except for CHR(0).

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

   The following example displays the ASCII values of the first
   16 bytes of a text file:

   handle = FOPEN("New.txt")
   IF FERROR() <> 0
      ? "File open error."
      RETURN
   ELSE
      buffer = FREADSTR(handle, 16)
      ? "Length: ", LEN(buffer)
      ?
      FOR i = 1 TO LEN(buffer)
         ?? TRANSFORM(ASC(SUBSTR(buffer, i, 1)),;
            "99")
      NEXT
      FCLOSE(handle)
   ENDIF
   RETURN




See Also: FERROR() FOPEN() FREAD() FSEEK() FWRITE()

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