FOpen filename$, fopenmode$, filenumber% Opens the file whose name is specified in the parameter filename$. In place of filenumber% you write a number for the file (which must be an integer value >= 1). In subsequent nuBASIC statements you use this number when referring to the file. It is possible to have several files open at once, but each must have a different file number. The parameter fopenmode$ is a string that specifies the kind of access that is requested for the file, as follows:
When a file is opened by using the "a" access type or the "a+" access type, all write operations occur at the end of the file. The file pointer can be repositioned by using Seek, but is always moved back to the end of the file before any write operation is carried out. Therefore, existing data cannot be overwritten. The "a" mode does not remove the EOF marker before it appends to the file. After appending has occurred the "a+" mode does remove the EOF marker. The "a+" mode is required for appending to a stream file that is terminated with the CTRL+Z EOF marker. When the "r+", "w+", or "a+" access type is specified, both reading and writing are allowed (the file is said to be open for "update"). However, when you switch from reading to writing, the Input operation must encounter an EOF marker. If there is no EOF, you must use an intervening call to a file positioning function. See also Open |