Creating a file of a certain type with Real Studio
I am making an editor with Real Studio for a special kind of file type. I made the file type with the File Type Editor, but how can I make a file output stream for that file type? Currently I am using:
DIM f AS Fold开发者_StackOverflow中文版erItem
DIM t AS TextOutputStream
f = GetFolderItem(fileName)
t = TextOutputStream.Create(f)
t.Write theData
t.Close
But that doesn't create a file openable by my editor. I am looking for something like this:
DIM f AS FolderItem
DIM t As FileTypes1.MyFileType.OutputStream
f = GetFolderItem(fileName)
t = FileTypes1.MyFileType.OutputStream.Create(f)
t.Write theData
t.Close
The TextOutputStream will only create text. You'll need to find out what the format definition is of type you're trying to create and duplicate it using the BinaryStream. More information about the BinaryStream can be found at http://docs.realsoftware.com/index.php/BinaryStream.
I just added this to my code:
f.MacCreator = FileTypes1.MyFileType.MacCreator
f.MacType = FileTypes1.MyFileType.MacType
so that my application recognizes the files.
精彩评论