beautypg.com

File – AMT Datasouth PAL User Manual

Page 105

background image

99

file

file

Description

Opens a data file for reading and/or writing.

Usage

FileStr AccessStr

file

OpenFile

FileStr

String. Specifies the name of the file to open.

AccessStr

String. Specifies the type of access to the file which the programmer desires.
PAL currently supports the value AccessStr values.

(a)

Write-only access. If the file exists, the file's write pointer will be
automatically set to the end of the file (append). If the file does not exist, the
file will be created.

(a+)

Read/write access. If the file exists, the file's read/write pointer will be
automatically set to the end of the file (append). If the file does not exist, the
file will be created. Same as (a) except read access permitted.

(r)

Read-only access. If the file exists, the file's read pointer will be
automatically placed at the start of the file. An error will result if the file
does not already exist.

(r+)

Read/write access. If the file exists, the file's read/write pointer will be
automatically placed at the start of the file. An error will result if the file
does not already exist. Same as (r) except write access permitted.

(w)

Write-only access. If the file exists, it will be truncated to zero bytes in
length. If the file does not already exist, the file will be created.

(w+)

Read/write access. If the file exists, it will be truncated to zero bytes in
length. If the file does not already exist, the file will be created. Same as (w)
except read access permitted.

OpenFile

File. File object associated with file just openned.

Comments

This operator provides the programmer with the ability to access data files on printers which
support data file storage. Data file storage can vary greatly from one PAL printer to the next. Some
printers may include floppy or hard disk drives. Other printers may include solid-state memory
cards. The programmer should consult each printer's documentation for information concerning
available data file storage.

After opening the requested file, PAL returns the file object OpenFile on the top of the stack.
Since the programmer can have an indefinite number of files open simultaneously, the PAL
operators which access files require the programmer to supply a file object as a parameter. The file
object tells each operator which file to access.