Difference between revisions of "FGETS()"

From Recital Documentation Wiki
Jump to: navigation, search
(Class)
Line 1: Line 1:
 
 
 
==Purpose==
 
==Purpose==
 
Function to read and return a line of text from an ASCII file
 
Function to read and return a line of text from an ASCII file
Line 30: Line 28:
  
 
==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]]

Revision as of 17:22, 27 November 2009

Purpose

Function to read and return a line of text from an ASCII file


Syntax

FGETS(<expN1>[,<expN2>][,<expC>])


See Also

FCLOSE(), FCREATE(), FEOF(), FERROR(), FFLUSH(), FOPEN(), FPUTS(), FREAD(), FREADSTR(), FSEEK(), FWRITE()


Description

The FGETS() function reads and returns a line of text from the file specified by <expN>, an ASCII file handle. The file handle is returned from the FCREATE() or FOPEN() functions. The FGETS() function reads a line of text from the current position of the record pointer. You may optionally specify the number of bytes to read from that point with the numeric expression <expN2>. The number of bytes may be from 0 to 254. If a number is not specified, the FGETS() function will read 254 bytes or to the end line marker. The optional character expression <expC> defines an end of line terminator to determine where the FGETS() function will stop reading. The character expression <expC> must evaluate to one or two characters.


Example

fp = fopen("names.txt")
count = 0
do while not feof()
    if fgets(fp,20) = "Smith"
        ++count
    endif
enddo


Products

Recital Server, Recital