Texas Instruments TI89 Developer Guide - Page 175
Opening Multiple Files for WRITE Mode
UPC - 033317198566
View all Texas Instruments TI89 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 175 highlights
Chapter 13: Memory Management 133 13.2.1. There is no separate mode to open a file for both reading and writing. However, if a file is opened in FM_APPEND mode the contents of the file are not erased. All locations in the file can either be read from or written to (random access). The file routines are: FClose FCreate FDelete FEof FFindFirst, FFindNext FGetC FGetPos FGetSize FOpen FPutC FRead FSetBufSize FSetPos FSetSize FSetVer FStatus FType FWrite - Close a file, this is required for files opened in write mode. - Create an empty file. - Delete a file. - Return TRUE if a file is at the End of File mark. - Used to search all files for a specific file type. - Return a byte from an open file. - Return the current file position. - Return the number of bytes stored in an opened file. - Open a file for reading, writing or both. - Write a byte to a file opened in write mode. - Read multiple bytes from a file. - Set the size of the write buffer for an opened file. - Set the position of the next read or write for an opened file. - Truncate the size of a file opened in write mode. - Change the version number of an opened file. - Return the status of an opened file. - Return the file type (description field) of a file. - Write multiple bytes to an opened file. Opening Multiple Files for WRITE Mode This section is only relevant if you plan on opening multiple files simultaneously in write mode. It requires some understanding of variables, specifically HSYMs which are explained in the next section. The FILES structure contains an HSYM of the opened file. HSYMs can become invalid whenever a new symbol table entry is added or a previous one is removed. In the FILE system the problem of HSYMs becoming invalid is only a problem if multiple files must be opened at the same time in WRITE or APPEND mode. Since the file system stores the HSYM of all opened variables in the FILES structure (this is needed for when the file is closed), creating a new file (which is just a symbol) with an existing file opened in WRITE mode may invalidate the previous file's HSYM. To get around this problem in the file system just use FCreate to create multiple files that must be opened simultaneously in WRITE mode before they are opened. This will insure TI-89 / TI-92 Plus Developer Guide Not for Distribution Beta Version January 26, 2001