VS:EOF: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
(fix missing backslashes)
 
Line 7: Line 7:
<desc>
<desc>
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.
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:
If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:
: <code>Macintosh HD:Applications:VectorWorks:Plug-Ins:Data:Notes.txt</code>
<dir>Macintosh HD:Applications:VectorWorks:Plug-Ins:Data:Notes.txt</dir>
: <code>C:\Program Files\VectorWorks\Plug-Ins\Data\Notes.txt</code>
<dir>C:Program FilesVectorWorksPlug-InsDataNotes.txt</dir>
 
 
If the filename includes a path relative to the location of the VectorWorks executable, the subfolder delimiters have to be backslashes:
If the filename includes a path relative to the location of the VectorWorks executable, the subfolder delimiters have to be backslashes:
: <code>Plug-Ins\Data\Notes.txt</code>


<dir>Plug-InsDataNotes.txt</dir>
If the filename does not include a path, the file is assumed to exist in the same folder as the VectorWorks executable.</desc>
If the filename does not include a path, the file is assumed to exist in the same folder as the VectorWorks executable.</desc>



Latest revision as of 09:51, 25 December 2017

.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