I | Open for input (reading) only. The file must already exist. Other processes may read from the file (but not write to it) while it's open with this method. |
O | Open for output (writing) only. If the file already exists, all of its current contents will be destroyed. You have exclusive access to the file (no other process can read from it nor write to it) while it's open with the "O" method. Does NOT support the "resource fork" open. |
R | Open for "random access." You can either read from or write to the file. The "file mark" (which indicates where the next read or write operation will occur) is placed initially at the beginning of the file. If you write to the file, you only replace those bytes which you're writing; the rest of the file's contents are unaffected. You have exclusive access to the file. |
A | Open for "append." This is just like method "R", except the file mark is placed initially at the end of the file. This method is normally used when you want to add data to the end of an existing file. |
N | Open for non-exclusive random access. This is just like method "R", except that other processes may read from the file while you have it open. Your process is the only one allowed to write to the file. |
D | Open the "data fork." This is the default value. |
R | Open the "resource fork." You should only specify this value if you're doing something like copying an entire resource fork from one file to another, or examining the internal structure of the resource fork. You should not use the Open statement when you want to read or write individual resources; in that case, use a Toolbox function such as HOpenResFile instead. Do not use the Open statement to create a new resource fork; use a Toolbox function such as HCreateResFile instead. |
open "I", 1, @spec | An FSSpec record is used |
open "I", 1, @ref | An FSRef object is used |
open "O", 3, fileName$, @parentFolderRef | An FSRef cannot be created for a non-existent file, so a filename and the FSRef of the parent directory must be supplied |
open "I", 2, @url | A CFURL object is used. |
open "A", 5, @ref | An FSRef object is used. |
open "R", 2, @ref | An FSRef object is used. |
open "I", 2, @url | A CFURL object is used. |