Important: The information in this document is obsolete and should not be used for new development.
PBExchangeFiles
You can use thePBExchangeFiles
function to exchange the data stored in two files on the same volume.
FUNCTION PBExchangeFiles (paramBlock: HParmBlkPtr; async: Boolean): OSErr;
paramBlock
- A pointer to a basic HFS parameter block.
async
- A Boolean value that specifies asynchronous (
TRUE) or synchronous (FALSE) execution.
--> ioCompletion
ProcPtr
A pointer to a completion routine. <-- ioResult
OSErr
The result code of the function. --> ioNamePtr
StringPtr
A pointer to a pathname. --> ioVRefNum
Integer
A volume specification. --> ioDestNamePtr
StringPtr
A pointer to the name of the destination file. --> ioDestDirID
LongInt
The destination file's parent directory ID. --> ioSrcDirID
LongInt
The source file's parent directory ID. DESCRIPTION
ThePBExchangeFiles
function swaps the data in two files by changing some of the information in the volume catalog and, if the files are open, in the file control blocks. ThePBExchangeFiles
function uses the file ID parameter block.You should use
PBExchangeFiles
to preserve the file ID when updating an existing file, in case the file is being tracked through its file ID.Typically, you use
PBExchangeFiles
after creating a new file during a safe save.
You identify the names and parent directory IDs of the two files to be exchanged in
the fieldsioNamePtr
,ioDestNamePtr
,ioSrcDirID
, andioDestDirID
. ThePBExchangeFiles
function changes the fields in the catalog entries that record the location of the data and the modification dates. It swaps both the data forks and the resource forks.The
PBExchangeFiles
function works on either open or closed files. If either file is open,PBExchangeFiles
updates any file control blocks associated with the file. Exchanging the contents of two files requires essentially the same access privileges as opening both files for writing.The
PBExchangeFiles
function does not require that file ID references exist for the files being exchanged.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector forPBExchangeFiles
are
Trap macro Selector _HFSDispatch $0017 RESULT CODES