![]() |
TXNSetDataFromFile |
||||
Header: | MacTextEditor.h | Carbon status: | Supported | |
Replaces a range of data with the contents of the file you specify.
OSStatus TXNSetDataFromFile ( TXNObject iTXNObject, SInt16 iFileRefNum, OSType iFileType, ByteCount iFileLength, TXNOffset iStartOffset, TXNOffset iEndOffset );
A variable of type TXNObject. Pass the text object that identifies the document in which you want to replace data.
A signed 16-bit integer. You use this to specify the HFS file reference obtained when you opened the file.
A variable of type OSType. You use this to specify the file type of the file from which you are getting data.
A variable of type ByteCount. You use this to specify how much data should be read. This parameter is ignored if the file type is the custom file format (TXTN) that MLTE supports. This parameter is useful when a caller uses MLTE to read data that is embedded in the callers private file. If you just want MLTE to deal with the whole file, set the iFileLength parameter to a value of kTXNEndOffset.
A variable of type TXNOffset. You use this to specify the start position at which to insert the file into the document. You can use the TXNGetSelection function to get the absolute offsets of the current selection.
A variable of type TXNOffset. You use this to specify the end position of range being replaced by the file. You can use the TXNGetSelection function to get the absolute offsets of the current selection.
A result code.
Your application must open the data fork of the file and set the iStartOffset parameter to the appropriate value before you call the TXNSetDataFromFile function. If you want to use the entire file, then set the iStartOffset parameter to 0. If you want to embed MLTE data within private or other MLTE data then you must set the file position to the appropriate position.
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)