Important: The information in this document is obsolete and should not be used for new development.
PBExchangeFiles
You can use thePBExchangeFilesfunction 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.
--> ioCompletionProcPtrA pointer to a completion routine. <-- ioResultOSErrThe result code of the function. --> ioNamePtrStringPtrA pointer to a pathname. --> ioVRefNumIntegerA volume specification. --> ioDestNamePtrStringPtrA pointer to the name of the destination file. --> ioDestDirIDLongIntThe destination file's parent directory ID. --> ioSrcDirIDLongIntThe source file's parent directory ID. DESCRIPTION
ThePBExchangeFilesfunction 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. ThePBExchangeFilesfunction uses the file ID parameter block.You should use
PBExchangeFilesto preserve the file ID when updating an existing file, in case the file is being tracked through its file ID.Typically, you use
PBExchangeFilesafter 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. ThePBExchangeFilesfunction 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
PBExchangeFilesfunction works on either open or closed files. If either file is open,PBExchangeFilesupdates 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
PBExchangeFilesfunction does not require that file ID references exist for the files being exchanged.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector forPBExchangeFilesare
Trap macro Selector _HFSDispatch $0017 RESULT CODES