FSClose
short fRefNum ; file reference, as obtained via FSOpen FSClose removes the access path of an open file and updates the directory entry for the file. The file must be re-opened before attempting any
subsequent file I/O calls.
fRefNum is the reference number of an open file. See FSOpen and OpenRF. noErr (0) No error
extFSErr (-58) External file system
fnfErr (-43) File not found
fnOpnErr (-38) File not open
ioErr (-36) I/O error
nsvErr (-35) No such volume
rfNumErr (-51) Bad fRefNum
Notes: DO NOT close a file that has already been closed. As incredible as it
sounds, it is possible to wipe out a disk if you do so. A safe suggestion is to
set your file reference number to 0 (an invalid value) after you close a
file; then if you close the file again, you'll get an error, rather than a
catastrophe.
FSClose (or even PBClose) does not guarantee that the file (or even the directory) on disk has been updated with any recent writes. You must use
FlushVol or PBFlushFile to ensure that data gets physically written to disk. Otherwise, a power outage or the chance of a system error will cause
work to be lost.