home *** CD-ROM | disk | FTP | other *** search
- DOS and DON'Ts -- Part 19
-
- by Joel Ellis Rea
-
-
-
- The format of an OPEN statement for
-
- APPEND is:
-
-
- OPEN <filenum>, <unitnum>, <chan-
- nelnum>, '<filename>,[<type>]
- ,A[PPEND]'
-
-
- Some examples:
-
-
- OPEN 8, 8, 8, "DATAFILE,A"
-
- OPEN F%, U%, C%, F$ + ",S,A"
-
- OPEN 1, 8, 2, "1:MACHLANG,P,A"
-
-
-
-
- The first example OPENs the file
-
- DATAFILE as file #8 via channel #8 of
-
- drive unit #8. The file type is not
-
- checked, and the OPEN succeeds if the
-
- file exists and is of type SEQ, PRG
-
- or USR (REL and DEL don't work with
-
- ,A[PPEND], of course). If the OPEN
-
- succeeds, all further PRINT#8 state-
-
- ments will write their data starting
-
- at the END of DATAFILE.
-
-
- The second example OPENs a file
-
- whose name is in the string variable
-
- F$, giving it the file reference num-
-
- ber specified in the integer variable
-
- F%, via the channel in C% on the unit
-
- in U%. Since the file type was speci-
-
- fied, the OPEN fails if the file is
-
- not found, or if it is found but is
-
- not of type SEQ.
-
-
- The third example OPENs file 'MACH-
-
- LANG', which must exist on drive 1 (of
-
- a two-unit drive such as a CBM 4040 or
-
- an MSD SD-2) as a PRG file. This
-
- might be used to add bytes to binary
-
- data such as a translation table.
-
-
- It is important to note that the ,A
-
- mode REQUIRES that the file ALREADY
-
- EXISTS on the disk. So before you can
-
- use the ,A mode on a new file, you
-
- must first create the file with the
-
- OPEN statement with a ,W parameter,
-
- followed by at least one PRINT# state-
-
- ment, followed by a CLOSE statement.
-
-
- ----------- End of Article -----------
-