- 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
| noErr | 0 | No error |
| ioErr | -36 | I/O error |
| fnOpnErr | -38 | File not open |
| fnfErr | -43 | File not found |
| rfNumErr | -51 | Bad reference number |
© Apple Computer, Inc.
2 JUL 1996