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 2 - File Manager / File Manager Reference
High-Level File Access Routines / Reading, Writing, and Closing Files


FSClose

You can use the FSClose function to close an open file.

FUNCTION FSClose (refNum: Integer): OSErr;
refNum
The file reference number of an open file.
DESCRIPTION
The FSClose function removes the access path for the specified file and writes the contents of the volume buffer to the volume.

Note
The FSClose function calls PBFlushFile internally to write the file's bytes onto the volume. To ensure that the file's catalog entry is updated, you should call FlushVol after you call FSClose.
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 "File Control Blocks" on page 2-81 for a description of how this can happen.
RESULT CODES
noErr0No error
ioErr-36I/O error
fnOpnErr-38File not open
fnfErr-43File not found
rfNumErr-51Bad reference number

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996