Carbon


TXNSave

Header: MacTextEditor.h Carbon status: Supported

Saves the contents of the document as the file type you specify.

OSStatus TXNSave (
    TXNObject iTXNObject, 
    OSType iType, 
    OSType iResType, 
    TXNPermanentTextEncodingType iPermanentEncoding, 
    FSSpec *iFileSpecification, 
    SInt16 iDataReference, 
    SInt16 iResourceReference
);
Parameter descriptions
iTXNObject

A variable of type TXNObject. Pass the text object for the active document.

iType

A variable of type OSType that specifies the file type to which the text object should be saved. The type must be ‘txtn’, ‘TEXT’, or ‘utxt.’

iResType

A variable of type OSType. The type of resource that should be used to save the style information if the file is being saved as plain text. This parameter is ignored for file types that are not plain text.

iPermanentEncoding

A variable of type TXNPermanentTextEncodingType. You use this to specify the encoding style in which to save the document. If the internal encoding being used by MLTE does not match the requested encoding type, the text is translated by the Text Encoding Conversion Manager.

iFileSpecification

A pointer to a variable of type FSSpec that specifies the location of the file. This parameter is retained and used in calls to the TXNRevert function. It is not retained once the text object is deleted or disposed.

iDataReference

A 16-bit integer. You use this to specify the data fork reference number of the open file.

iResourceReference

A 16-bit integer. You use this to specify the resource fork reference number of the open file. This parameter is ignored if the file type is not ‘TEXT’. You can save text without style information by passing -1 for this parameter.

function result

A result code.

DISCUSSION

You must first open the file to which you want to save the document. If you are saving the file as plain text and the application has specified a resource type in which to save style attributes, then you must also open the file’s resource fork.

MLTE does not move the marker before writing the file. You must make sure the file marker of the opened file is at the position where you want data to be written. Typically, this is position 0, but you can specify any valid file position. This behavior lets you write private data, followed by data that is written by MLTE, which can subsequently be followed by more private data or even another MLTE file.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 7/17/2000)