Difference between revisions of "FREADSTR()"

From Recital Documentation Wiki
Jump to: navigation, search
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
==Class==
 
ASCII File Access
 
 
 
 
==Purpose==
 
==Purpose==
 
Function to return a character string from a text file
 
Function to return a character string from a text file
Line 40: Line 36:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:ASCII File Access]]
 
[[Category:ASCII File Access]]
 
[[Category:ASCII File Access Functions]]
 
[[Category:ASCII File Access Functions]]

Latest revision as of 16:04, 2 December 2009

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 Server, Recital