PBFlushVolSync
PBFlushVol
Update disk with any unwritten data #include <Files.h> File Manager (PBxxx)
OSErr PBFlushVol(pb, async ); Boolean async ; 0=await completion; 1=immediate return PBFlushVol stores to disk all unwritten data currently in the volume
buffer. It should be called periodically, typically after closing a file, to
protect against power loss or unexpected disk ejection.
pb is the address of a 64-byte VolumeParam structure or any of the variants that contain all the relevant fields:
Out-In Name Type Size Offset Description
-> ioCompletion ProcPtr 4 12 Completion routine address (if async =TRUE) -> ioNamePtr StringPtr 4 18 Address of volume name (or NIL) -> ioVRefNum short 2 22 Volume reference number of volume to flush
<- ioResult OSErr 2 16 Error Code (0=no error, 1=not done yet) async is a Boolean value. Use FALSE for normal (synchronous) operation or TRUE to enqueue the request and resume control immediately. See Async I/O.
noErr (0) No error
bdNamErr (-37) Bad name
extFSErr (-58) External file system
nsDrvErr (-56) No such drive
nsvErr (-35) No such volume
paramErr (-50) No default volume
Notes: If ioNamePtr is NIL and ioVRefNum is 0, the default volume is flushed (see
SetVol). If the volume buffer has not changed since the last call to PBFlushVol, this function has no effect.
PBFlushVol is called automatically whenever a disk is ejected
File information is not necessarily written to the media when a file is
closed. Thus, it is a good practice to flush the volume occasionally, to
minimize problems of power-outages and system crashes.
Use PBFlushFile to flush the contents of a single file to disk. You may want to use async =TRUE and set ioCompletion=0 to avoid program delays. See Async I/O.