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| Name | Type | Description |
|---|---|---|
| fileName | STRING | Name of file. |
BEGIN
Open('MyData');
WHILE NOT EOF('MyData') DO
ReadLn(a,b,c,d);
Close('MyData');
END;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()WHILE NOT EOF (datafile) DO
BEGIN
Read (size1);
IF size1 = size THEN
BEGIN
ReadLn (a, b, t, rf, rt);
sizeNotFound := FALSE;
{
message( ' #### gBoltType = ',gBoltType ,' nominalSize = ',nominalSize );
}
{ Read the data file until screwSize equals or exceeds the size }
WHILE( NOT EOF( fileName ) ) & ( NOT sizeFound ) DO
BEGIN
ReadLn( screwSize, gBoltDia, tpi, gHeadDia, gHeadHeight, gSquareWidth, gSquareHeight, gCornerRadius, gFilletR );
sizeFound := ( screwSize = nominalSize );
END;
WHILE NOT EOF (datafile) DO
BEGIN
Read (size1);
IF size1 = size THEN
BEGIN
ReadLn (d, tw, w, tf, a, b, rt, rf);
sizeNotFound := FALSE;import vs
# Function EOF returns TRUE if the file pointer of an open text file has
# reached the end of the file (EOF marker).
fileName = 'C:/Temp/example.txt'
ok = vs.EOF(fileName)
if ok:
vs.Message('EOF succeeded')
else:
vs.Message('EOF failed')Availability: from All Versions