VS:EOF

From Vectorworks Developer
Revision as of 09:51, 25 December 2017 by CBM-c- (talk | contribs) (fix missing backslashes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Function EOF returns TRUE if the file pointer of an open text file has reached the end of the file (EOF marker). Function EOF is used with Procedures Read and ReadLn to ensure proper file reading and closure. Parameter fileName specifies a text file which is open for reading or writing.


If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:

Macintosh HD:Applications:VectorWorks:Plug-Ins:Data:Notes.txt
C:\Program Files\VectorWorks\Plug-Ins\Data\Notes.txt


If the filename includes a path relative to the location of the VectorWorks executable, the subfolder delimiters have to be backslashes:

Plug-Ins\Data\Notes.txt


If the filename does not include a path, the file is assumed to exist in the same folder as the VectorWorks executable.

FUNCTION EOF(
fileName :STRING) : BOOLEAN;
def vs.EOF(fileName):
    return BOOLEAN

Parameters

fileName STRING Name of file.

Example

VectorScript

BEGIN
Open('MyData');
WHILE NOT EOF('MyData') DO
ReadLn(a,b,c,d);
Close('MyData');
END;

Python

def Example():
	vs.Open('D:\test.txt')
	while not vs.EOF('D:\test.txt'):
		a,b,c,d = vs.ReadLn()
	vs.Close('D:\test.txt')
	vs.Message(a)

Example()

Version

Availability: from All Versions