Important: The information in this document is obsolete and should not be used for new development.
FSClose
You can use theFSClose
function to close an open file.
FUNCTION FSClose (refNum: Integer): OSErr;
refNum
- The file reference number of an open file.
DESCRIPTION
TheFSClose
function removes the access path for the specified file and writes the contents of the volume buffer to the volume.
- Note
- The
FSClose
function callsPBFlushFile
internally to write the file's bytes onto the volume. To ensure that the file's catalog entry is updated, you should callFlushVol
after you callFSClose
.- WARNING
- Make sure that you do not call
FSClose
with a file reference number
of a file that has already been closed. Attempting to close the same file twice may result in loss of data on a volume. See the description of
file control blocks in the chapter "File Manager" in this book for a discussion of how this can happen.RESULT CODES
noErr 0 No error ioErr -36 I/O error fnOpnErr -38 File not open fnfErr -43 File not found rfNumErr -51 Bad reference number