Start Back Next End
  
ZBasic System Library
ZBasic Microcontrollers
16
File.Open
Type
Function returning Integer
Invocation
File.Open(filename, mode)
Parameter
Method
Type
Description
filename
ByVal
String
The name of the file to be opened.
mode
ByVal
anyIntegral
The mode in which the file will be opened (see discussion).
Discussion
This function opens the named file (subject to the mode value) and returns a non-negative file handle (to
be used in other operations) if successful.  If the file cannot be opened as specified the return value will
be negative.
The mode parameter can be a combination of the values in the table below.  Note, however, that some
combinations are contradictory and will result in failure to open.
Mode Values for File.Open
Value
Value
Meaning
&H01
1
Open an existing file, writes add to the end of the file.
&H02
2
Open an existing file, truncate it to zero length.
&H04
4
Create a new file, deleting an existing file with the same name.
&H08
8
Prepare for read-only operation (writes will fail).
&H10
16
Prepare for write-only operation (reads will fail).
&H18
24
Prepare for read and write operations.
&H20
32
Do not cache write data.
&H44
68
Create a new file, fail if file exists already.
Previous page Top Next page