Viva Clipper !

FReadStr()

Advertisements

FREADSTR()

Reads a string from a file opened with low-level access

Syntax

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

Arguments

<nHandle> DOS file handle number.

<nBytes> Number of bytes to read.

Returns

<cString> an character expression

Description

This function returns a character string of <nBytes> bytes from a file whose DOS file handle is <nHandle>.

The value of the file handle <nHandle> is obtained from either the FOPEN() or FCREATE() functions.

The value of <nBytes> is the number of bytes to read from the file. The returned string will be the number of characters specified in <nBytes> or the number of bytes read before an end-of-file charac- ter (ASCII 26) is found.

NOTE This function is similar to the FREAD() function, except that it will not read binary characters that may he required as part of a header of a file construct. Characters Such as CHR(0) and CHR(26) may keep this function from performing its intended operation. In this event, the FREAD() function should he used in place of the FREADSTR() function.

Examples

      #include "fileio.ch"
      IF ( nH := FOpen( "x.txt" ) ) != F_ERROR
         cStr := FReadStr( nH, 100 )
         ? cStr
         FClose( nH )
      ENDIF

Compliance

Clipper

Platforms

All (64K)

Files

Library is rtl

Seealso

BIN2I(), BIN2L(), BIN2W(), FERROR(), FREAD(), FSEEK()

Advertisements

Advertisements