Important: The information in this document is obsolete and should not be used for new development.
FSpExchangeFiles
You can use theFSpExchangeFilesfunction to exchange the data stored in two files on the same volume.
FUNCTION FSpExchangeFiles (source: FSSpec; dest: FSSpec): OSErr;
source- The source file. The contents of this file and its file information are placed in the file specified by the
destparameter.dest- The destination file. The contents of this file and its file information are placed in the file specified by the
sourceparameter.DESCRIPTION
TheFSpExchangeFilesfunction swaps the data in two files by changing the information in the volume's catalog and, if the files are open, in the file control
blocks. You should useFSpExchangeFileswhen updating an existing file, so
that the file ID remains valid in case the file is being tracked through its file ID.
TheFSpExchangeFilesfunction 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
FSpExchangeFilesfunction works on both open and closed files. If either file is open,FSpExchangeFilesupdates any file control blocks associated with the file. Exchanging the contents of two files requires essentially the same access permissions as opening both files for writing.The files whose data is to be exchanged must both reside on the same volume. If they do not,
FSpExchangeFilesreturns the result codediffVolErr.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector forFSpExchangeFilesare
Trap macro Selector _HighLevelHFSDispatch $000F RESULT CODES