Append | File I/O |
Declaration:
PROCEDURE Append
( fileName:STRING ) ; Description:
Procedure Append opens the specified file for writing and appends the data to the end of the file. Existing data in the file is NOT overwritten.
Parameters:
fileName Name of file to open for writing. Example:
Append('MyFile');
Close | File I/O |
Declaration:
PROCEDURE Close
( fileName:STRING ) ; Description:
Procedure Close closes the specified text file.
Parameters:
fileName Name of file to close. Example:
BEGIN Open('MyData'); WHILE NOT EOF('MyData') DO ReadLn(a,b,c,d); Close('MyData'); END;
EOF | File I/O |
Declaration:
FUNCTION EOF
( fileName:STRING ) :BOOLEAN ; 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.
Parameters:
fileName Name of file. Example:
BEGIN Open('MyData'); WHILE NOT EOF('MyData') DO ReadLn(a,b,c,d); Close('MyData'); END;
EOLN | File I/O |
Declaration:
FUNCTION EOLN
( fileName:STRING ) :BOOLEAN ; Description:
Function EOLN returns TRUE if the file pointer of an open text file has reached a carriage return within the file. Parameter fileName specifies a text file which is open for reading or writing.
Parameters:
fileName Name of file. Example:
BEGIN Open('MyData'); WHILE NOT EOLN('MyData') DO Read(a,b,c,d); Close('MyData'); END;
GetFile | File I/O |
Declaration:
PROCEDURE GetFile
( VAR fileName:STRING ) ; Description:
Procedure GetFile displays a standard file dialog which requests the user to select a text document.
It is advisable to call DidCancel after using this procedure and check that the user did not cancel the file selection process.
Parameters:
fileName Returns name of selected file. Example:
GetFile(fileName); IF NOT DidCancel THEN BEGIN Read(a,b,c); Close(fileName); END; {Select a file for reading via a file open dialog}
GetFolderPath | File I/O |
Declaration:
FUNCTION GetFolderPath
( whichPath:INTEGER ) :STRING ; Description:
Function GetFolderPath returns the full path to the requested folder independent of localized folder names.
A table of preference dialog items and their corresponding IDs may be found in theParameters:
whichPath Path constant. Example:
GetFolderPath();
Open | File I/O |
Declaration:
PROCEDURE Open
( fileName:STRING ) ; Description:
Procedure Open opens a ASCII text file for reading and/or writing.
Remember to use Close when you are finished reading or writing to a file.
Parameters:
fileName Name of file to open.
PutFile | File I/O |
Declaration:
PROCEDURE PutFile
( commentStr :STRING; defaultStr :STRING; VAR fileName :STRING ) ; Description:
Procedure PutFile displays a standard file dialog which requests the user to select or create a text file for output.
Parameters:
commentStr User prompt string for dialog. defaultStr Default file name string. fileName Returns name of the user selected file. Example:
Read | File I/O |
Declaration:
PROCEDURE Read
( VAR z1 :ANY; VAR z2 :ANY; VAR ... :ANY; VAR zN :ANY ) ; Description:
Procedure Read will read data from a currently open text file. The variable length parameter list returns the read data in the specified parameters.Supported data types include INTEGER, REAL, LONGINT, CHAR or STRING.
Non STRING data values must be separated by a tab or space to be correctly read into variables. If the procedure encounters an EOF(end-of-file) marker, an error is generated. Read does not position the file position pointer to the beginning of a new line after the procedure is called.
Read will detect tabs as delimiters, allowing multiple string values to be assigned to variables.
ReadLn | File I/O |
Declaration:
PROCEDURE ReadLn
( VAR z1 :ANY; VAR z2 :ANY; VAR ... :ANY; VAR zN :ANY ) ; Description:
Procedure ReadLn will read data from a currently open text file. The variable length parameter list returns the read data in the specified parameters.
Supported data types include INTEGER, REAL, LONGINT, CHAR or STRING. If the procedure encounters an EOF(end-of-file) marker, an error is generated. ReadLn positions the file position pointer to the beginning of a new line after the procedure is called.
ReadLn will detect tabs as delimiters, allowing multiple string values to be assigned to variables.
Example:
ReadLn(Val1,Val2,Val3);
Rewrite | File I/O |
Declaration:
PROCEDURE Rewrite
( fileName:STRING ) ; Description:
Procedure Rewrite creates a new ASCII text file or opens an existing one prior to writing data to the file. If the file exists, new data written to the file will overwrite any data currently within the file.Parameters:
fileName Name of file.
Space | File I/O |
Declaration:
PROCEDURE Space
( n:INTEGER ) ; Description:
Procedure Space writes a space to the current output file.Parameters:
n Number of spaces. Example:
Space(5); {write 5 spaces to the output file}
StdRead | File I/O |
Declaration:
PROCEDURE StdRead
( VAR z1 :ANY; VAR z2 :ANY; VAR ... :ANY; VAR zN :ANY ) ; Description:
Procedure StdRead will read data from a currently open text file. The variable length parameter list returns the read data in the specified parameters.
Supported data types include INTEGER, REAL, LONGINT, CHAR or STRING. Non STRING data values must be separated by a tab or space to be correctly read into variables. If the procedure encounters an EOF(end-of-file) marker, an error is generated. StdRead does not position the file position pointer to the beginning of a new line after the procedure is called.
StdRead reads data according to the Pascal language standard. This differs from the Read procedure found in VectorScript primarily when reading STRING data. StdRead will read all characters, including tabs and spaces, as a single string value. Read will detect tabs as delimiters, allowing multiple string values to be assigned to variables.Example:
GetFile(fName); IF NOT DidCancel THEN BEGIN Open(fName); StdRead(partID,partName); END;
StdReadLn | File I/O |
Declaration:
PROCEDURE StdReadLn
( VAR z1 :ANY; VAR z2 :ANY; VAR ... :ANY; VAR zN :ANY ) ; Description:
Procedure StdReadLn will read data from a currently open text file. The variable length parameter list returns the read data in the specified parameters.
Supported data types include INTEGER, REAL, LONGINT, CHAR or STRING. Non STRING data values must be separated by a tab or space to be correctly read into variables. If the procedure encounters an EOF(end-of-file) marker, an error is generated. StdReadLn positions the file position pointer to the beginning of a new line after the procedure is called.
StdReadLn reads data according to the Pascal language standard. This differs from the ReadLn procedure found in VectorScript primarily when reading STRING data. StdReadLn will read all characters, including tabs and spaces, as a single string value. ReadLn will detect tabs as delimiters, allowing multiple string values to be assigned to variables.
Example:
GetFile(fName); IF NOT DidCancel THEN BEGIN Open(fName); StdReadLn(partID,partName); END;
Tab | File I/O |
Declaration:
PROCEDURE Tab
( n:INTEGER ) ; Description:
Procedure Tab writes a tab character to the current output file.Parameters:
n Number of tab characters to be written to file. Example:
Tab(2); {writes two tabs to the output file}
Write | File I/O |
Declaration:
PROCEDURE Write
( z1 :ANY; z2 :ANY; ... :ANY; zN :ANY ) ; Description:
Procedure Write outputs the specified data to an ASCII text file. The variable length parameter list specifies the data to be written to the file.
Parameters may be any valid data type, and data types may be mixed in a single call to the procedure. Write leaves the file pointer positioned at the end of the last data value written to the file; any data subsequently written to the file will be appended to the end of this value.
Details on formatting data in Write procedure calls can be found in theExample:
Write(Value1);
WriteLn | File I/O |
Declaration:
PROCEDURE WriteLn
( z1 :ANY; z2 :ANY; ... :ANY; zN :ANY ) ; Description:
Procedure WriteLn outputs the specified data to an ASCII text file. The variable length parameter list specifies the data to be written to the file.
Parameters may be any valid data type, and data types may be mixed in a single call to the procedure. A carriage return is appended to the end of the line of data, so that the file pointer is at the beginning of a new line in the file, and any data written to the file after the procedure call will be on the new line.
Details on formatting data in WriteLn procedure calls can be found in theExample:
WriteLn('Mfr/Cost',Vendor,'/',thePrice+Tax);