Difference between revisions of "FEOF()"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to check if the file pointer is at the end of an ASCII file
 
Function to check if the file pointer is at the end of an ASCII file
 
  
 
==Syntax==
 
==Syntax==
 
FEOF(<expN>)
 
FEOF(<expN>)
 
  
 
==See Also==
 
==See Also==
 
[[FCLOSE()]], [[FCREATE()]], [[FERROR()]], [[FFLUSH()]], [[FGETS()]], [[FOPEN()]], [[FPUTS()]], [[FREAD()]], [[FSEEK()]], [[FWRITE()]]
 
[[FCLOSE()]], [[FCREATE()]], [[FERROR()]], [[FFLUSH()]], [[FGETS()]], [[FOPEN()]], [[FPUTS()]], [[FREAD()]], [[FSEEK()]], [[FWRITE()]]
 
  
 
==Description==
 
==Description==
 
The FEOF() returns a logical true (.T.) if the file pointer is at the end of the specified ASCII file.  The ASCII file is specified by its file handle <expN>.  The file handle should be assigned to a memory variable when the file is opened with the FCREATE() or FOPEN() functions.
 
The FEOF() returns a logical true (.T.) if the file pointer is at the end of the specified ASCII file.  The ASCII file is specified by its file handle <expN>.  The file handle should be assigned to a memory variable when the file is opened with the FCREATE() or FOPEN() functions.
 
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
use accounts
+
open database southwind
fp=fopen("existing.file")
+
use shippers
if fp > 0
+
copy to ship.txt type csv
  do while not feof(fp)
+
fd=fopen("ship.txt")
      ? fgets(fp)
+
 
  enddo
+
do while .t.
endif
+
cGetLine = fgets(fd)
 +
if feof(fd)
 +
exit
 +
else
 +
// process
 +
endif
 +
enddo
 +
fclose(fd)
 
</code>
 
</code>
  
 
==Products==
 
Recital Server, Recital
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:ASCII File Access]]
 
 
[[Category:ASCII File Access Functions]]
 
[[Category:ASCII File Access Functions]]

Latest revision as of 06:14, 22 October 2013

Purpose

Function to check if the file pointer is at the end of an ASCII file

Syntax

FEOF(<expN>)

See Also

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

Description

The FEOF() returns a logical true (.T.) if the file pointer is at the end of the specified ASCII file. The ASCII file is specified by its file handle <expN>. The file handle should be assigned to a memory variable when the file is opened with the FCREATE() or FOPEN() functions.

Example

open database southwind
use shippers
copy to ship.txt type csv
fd=fopen("ship.txt")
 
do while .t.
	cGetLine = fgets(fd)
	if feof(fd)
		exit
	else
		// process
	endif
enddo
fclose(fd)