Using FileIO
============
If automatic opening is desired, place a copy of the FileIO Xtra for your
platform
into Application Xtra's folder. If automatic opening is not desired, the
Xtra can be
placed anywhere and opened using Lingo's 'openXLib' command. This applies
to
projector's as well, the Xtra must be placed in an Xtra's folder in the
same folder
as the projector.
Example Lingo
Known Problems
==============
The createFile() method does not support relative filenames, or the Lingo
'@'
operator in pathnames. This will be fixed in a later version.
The displaySave() method does not directly inform Lingo whether a user is
replacing an existing file. The workaround is to attempt to create the
file using
createFile() and check the error code for a "File Already Exists" error.
History
=======
09dec97 (v1.0.4)
18apr97 (v1.0.2)
27may96 (v1.0.1)
Method Reference
================
The first line of each definition contains the method name, a list of
parameters and
thier value types. The internal name of the FileIO Xtra is "fileio". This
name is
used whenever referencing the xtra using the form 'xtra "fileio"'.
Note that while Director and projector's can use net-based files by
supplying a URL
for a filename, the FileIO Xtra cannot. It is limited to accessesing
files available
via filesystems mounted on the local system.
---
---
---
fileName( instance )
Returns the fileName string of the current open file. The file must be
open use this
method.
---
status( instance )
Returns the error code returned by the last method called. The value is
returned as
an integer.
---
---
---
Opens the named file. This call must be used before any read/write
operations can
take place. The filename can be either a fully-qualified path and
filename, or a
relative filename. The Lingo '@' pathname operator is supported. The
openMode
parameter specifies whether to open the file in Read, Write or ReadWrite
mode. Valid
Flags are: 0 Read/Write, 1 Read, 2 Write.
---
closeFile( instance )
Closes a file that has been previously opened using the openFile()
method.
---
displayOpen( instance )
---
---
---
Sets the file position of the current open file. The file must be open to
use this
method.
---
getPosition( instance )
Gets the file position of the current open file. Returned as an integer.
The file
must be open to use this method.
---
getLength( instance )
Gets the length of the currently opened file. Returned as an integer. The
file must
be open use this method. The value returned is the length of the file in
bytes.
---
Writes a single character to the file at the current position. The file
must be open
in write or read/write mode to use this method.
---
Writes a string to the file at the current position. The file must be
open in write
or read/write mode to use this method.
---
readChar( instance )
---
readLine( instance )
Reads from the current position up to and including the next CR,
increments the
position, and returns the string to Lingo. The file must be open in read
or
read/write mode to use this method.
---
readFile( instance )
Reads from the current position to the end of the file and returns the
file to Lingo
as a string. The file must be open in read or read/write mode to use
this method.
---
readWord( instance )
Reads the next word starting at the current position. The file must be
open in read
or read/write mode to use this method.
---
---
getFinderInfo( instance )
Returns the Type and Creator of the current file as a string. This method
does
nothing when used under Windows. The file must be open to use this
method.
---
Sets the Type and Creator of the current file. The string takes the form
of a space
seperated set of TYPE and CREATOR codes (e.g. "TEXT TTXT"). This method
does nothing
when used under Windows. The file must be open to use this method.
---
delete( instance )
Deletes the currently opened file. The file must be open use this
method.
---
version( xtraRef )
---
getOSDir( )
Global method that returns the full path to either the Windows directory,
or the System Folder
depending on which OS is currently being used. Does not require a child
instance or
Xtra reference to call.
---