
statement PRINT# 5, A$; B$; C$:
char
CR stands for the CRR$ code of 13, the carriage return, which is PRINTed
at the end of every PRINT or PRINT# statement unless there is a comma or
semicolon at the end of the line.
NOTE: Do not leave a space between PRINT and #, and do not try to
abbreviate the command as ?#. See the appendixes in the user manual for
the correct abbreviation.
FORMAT FOR INPUT#STATEMENT:
INPUT# file#, variable list
When using the INPUT# to read this data in, there is no way to tell that
it's not supposed to be one long string. You need something in the file to act as a
separator. Characters to use as separators include the CR, a comma or a
semicolon. The CR can be added easily by just uSingone variableper line on the
PRINT# statement, and the system pUtsone there automatically. The statement
PRINT# 5, A$: PRINT# 5, B$: PRINT# 5, C$ puts a CR after every variable
being written, providing the proper separation for a statement like INPUT#5,
AS, B$, C$. Or else a line like Z$= ..,": PRINT# 5, A$ Z$ B$Z$ C$ will do the
job as well, and in less space. The file after that line looks like this:
char
Putting commas between variablesresults in lots of extra space on the disk
being used. A statement like PRINT# 5, A$, B$ makes a file that looks like:
char
You can see that much of the space in the file is wasted.
The moral of all this is: take care when using PRINT# so your data will be
in order for reading back in.
Numeric data written in the file takes the form of a string, as if the STR$
function had been performed on it before writing it out. The first character will
be a blank space if the number is positive, and a minus sign (-) if the number is
negative. Then comes the number,and the last character is the cursor right
character. This format provides enough information for the INPUT# statement
to read them in as separate numbers if several are written with no other special
separators. It is somewhat wasteful of space, since there can be two unused
21
Komentáře k této Příručce