Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 1 - Introduction to File Management / File Management Reference
File and Directory Manipulation Routines / Opening, Creating, and Deleting Files


FSpOpenDF

You can use the FSpOpenDF function to open a file's data fork.

FUNCTION FSpOpenDF (spec: FSSpec; permission: SignedByte;
                     VAR refNum: Integer): OSErr;
spec
An FSSpec record specifying the file whose data fork is to be opened.
permission
A constant indicating the desired file access permissions.
refNum
A reference number of an access path to the file's data fork.
DESCRIPTION
The FSpOpenDF function opens the data fork of the file specified by the spec parameter and returns a file reference number in the refNum parameter. You can pass that reference number as a parameter to any of the low- or high-level file access routines.

The permission parameter specifies the kind of access permission mode you want. You can specify one of these constants:

CONST
   fsCurPerm      =  0;    {whatever permission is allowed}
   fsRdPerm       =  1;    {read permission}
   fsWrPerm       =  2;    {write permission}
   fsRdWrPerm     =  3;    {exclusive read/write permission}
   fsRdWrShPerm   =  4;    {shared read/write permission}
In most cases, you can simply set the permission parameter to fsCurPerm. Some applications request fsRdWrPerm, to ensure that they can both read from and write to a file.

RESULT CODES
noErr0No error
nsvErr-35No such volume
ioErr-36I/O error
bdNamErr-37Bad filename
tmfoErr-42Too many files open
fnfErr-43File not found
opWrErr-49File already open for writing
permErr-54Attempt to open locked file for writing
dirNFErr-120Directory not found or incomplete pathname
afpAccessDenied-5000User does not have the correct access to the file

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996