FREADSTR()
Class
ASCII File Access
Purpose
Function to return a character string from a text file
Syntax
FREADSTR(<expN1>, <expN2>)
See Also
FCLOSE(), FCREATE(), FEOF(), FERROR(), FFLUSH(), FGETS(), FOPEN(), FPUTS(), FREAD(), FSEEK(), FWRITE(), MEMOREAD(), MEMOWRITE(), TEXTEDIT()
Description
The FREADSTR() function returns the next line of a text file, opened by FOPEN(), as a character string. The <expN1> is the file pointer obtained from FOPEN(). The maximum number of bytes to read is specified by the value in <expN2>. The FREADSTR() function sequentially reads each line from the opened text file each time it is used on the file. If an error occurs during the operation, -1 is assigned to the FERROR() function. The file pointer must be assigned when the file is first opened using the FOPEN() function.
Example
use accounts fp=fopen("existing.txt") if ferror()=-1 dialog box "The file could not be opened." else string = freadstr(fp,80) do while not empty(string) ? string string = freadstr(fp,80) enddo endif fclose(fp) if ferror()=-1 dialog box "The file could not be closed." endif
Products
Recital Database Server, Recital Mirage Server, Recital Terminal Developer