CLOSE
instruction: close a file
Close file number
You must remember to always CLOSE a file after you have finished with it. If you forget to do this, any changes that have been made to the file will be lost.
PRINT #
structure: print variables to a file or device
Print #channel,variable list
This command is used in the same way as a normal PRINT instruction, but instead of printing information on screen it puts that information into one of your files. Simply specify the channel number to be used, then the variables you want to print out to the file. Remember to close the file's channel number afterwards, like this:
E> Open Out 2,"sequential.two" Print #2,"Just testing" Close 2
As with PRINT, the PRINT # command can be abbreviated to ? #.
INPUT #
structure: input variables from a file or device
Input #channel,variable list
INPUT # reads information from either a sequential file or a device such as the serial port (see OPEN PORT in Chapter 10.4), and loads these values into a set of variables. As with the normal INPUT command, each value in the list must be separated by a comma. Additionally, every line of data needs to be ended by its own line feed character, which is the equivalent of the [Return] pressed when a line is entered from the keyboard. For example:
E> Open In 2,"sequential.two" : Rem Open file created by previous example Input #2,A$ Print A$ Close 2
LINE INPUT #
structure: input variables not separated by a comma
Line Input #channel,variable list
This function is identical to INPUT #, except that it allows you to separate your list of data using a carriage return sequence, instead of the standard comma.
When reading text documents, LINE INPUT # is always recommended, because the commas used in normal written English will be treated as separators by the INPUT # structure.