Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 7 - Translation Manager / Translation Manager Reference
Translation Manager Routines / Translating Files


TranslateFile

You can use TranslateFile to translate a document from one format to another.

FUNCTION TranslateFile (sourceDocument: FSSpec; 
                        destinationDocument: FSSpec; 
                        howToTranslate: FileTranslationSpec) 
                        : OSErr;
sourceDocument
The document to translate.
destinationDocument
The file to put the translated document into.
howToTranslate
A buffer of information indicating how to translate the document.
DESCRIPTION
The TranslateFile function reads the file specified by the sourceDocument parameter and translates it into another format. You specify in the destinationDocument parameter the name and location of a file to contain the translated data. Note that your application only specifies the name and location for
the file; TranslateFile creates the file and puts the translated data into it. The destination file must not exist before you call TranslateFile.

The translation is performed according to the information provided in the howToTranslate parameter. Usually, you'll get that information by calling CanDocBeOpened.

SPECIAL CONSIDERATIONS
The TranslateFile function is not available in all versions of system software; use the Gestalt function to determine whether the Translation Manager is available before calling it.

The TranslateFile function might cause memory to be moved or purged; you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the TranslateFile procedure are
Trap macroSelector
_TranslationDispatch$000C

RESULT CODES
noErr0No error
dirFulErr-33Directory full
dskFulErr-34Disk full
nvsErr-35No such volume
ioErr-36I/O error
bdNamErr-37Bad filename
tmfoErr-42Too many files open
fnfErr-43File not found
wPrErr-44Disk is write protected
fLckdErr-45File is locked
vLckdErr-46Volume is locked
dupFNErr-48Duplicate filename (rename)
opWrErr-49File already open with write permission
extFSErr-58External file system
dirNFErr-120Directory not found
userCanceledErr-128User canceled
badTranslationSpecErr-3031howToTranslate is invalid

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996