Sharp OZ-707 Operation Manual - Page 84

Open, Print

Page 84 highlights

INPUT# p o FORMAT: INPUT# file number, variable, variable, ..., variable Abbreviation: 1.# See Also: OPEN, PRINT# PURPOSE: Reads items from sequential files on the RAM disk E. REMARKS: The file number is the number given to the file when opened for input with the OPEN statement. The file number must be a number specified in an OPEN statement. If the device name is specified as COM in the OPEN statement, it is not necessary to open for input with the OPEN statement. Specify variables as follows: • Fixed variables (A, X, etc.) • Simple variables (CD, EF$, A#, 8$, etc.) • Array elements (8(10), C$(5,5), etc.) An error occurs if the file contains less data than the number of specified variables. If the file contains more data, the rest of the data is ignored. The data and variables must be of the same type (e.g., numeric values must be assigned to numeric variables, single-precision values to single-precision variables, double-precision values to double-precision variables, etc.) Use a comma (,) , space (&H20), CR (&HOD), LF (&HOA), or CR + LF as a delimiter when data are read into numeric variables. Spaces preceding data are ignored. Use a comma (,), CR, LF, or CR + LF as a delimiter to read data into character variables. Spaces preceding data are ignored. If a double quotation mark appears at the beginning of data, data is read up to the next double quotation mark. A comma in a character string enclosed by double quotation marks is assumed not to be a delimiter. 156 EXAMPLE: 10: A$ = "AS" + CHR$ 34 + "CDEn + CHR$ 34 20: S$ = CHR$ 34 + "CD,EF" + CHR$ 34 30: PRINT A$ 40: PRINT B$ 50: OPEN nE:ABC.DAT" FOR OUTPUT AS #2 60: PRINT #2,A$;",";B$ 70: CLOSE 80: OPEN "E:ABC.DAT" FOR INPUT AS #2 90: INPUT #2, C$, D$ 100: PRINT C$ 110: PRINT D$ 120: CLOSE:END Execution RUN IEMlER I AS"CDE" "CD,EF" AB"CDE" CD ,EF 157

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128

INPUT#
FORMAT:
INPUT# file number, variable, variable,
...
, variable
Abbreviation:
1.#
See
Also:
OPEN, PRINT#
PURPOSE:
Reads items from sequential files
on
the RAM disk
E.
REMARKS:
p
o
The file number
is
the number given to the file when opened for input
with the OPEN statement. The file number must be a number specified
in
an
OPEN statement. If the device name is specified
as
COM
in
the
OPEN statement, it
is
not necessary
to
open for input with the OPEN
statement.
Specify variables as follows:
• Fixed variables
(A,
X,
etc.)
• Simple variables (CD, EF$,
A#,
8$, etc.)
• Array elements (8(10), C$(5,5), etc.)
An error occurs if the file contains less data than the number of
specified variables. If the file contains more data, the rest of the data
is
ignored.
The data and variables must be of the same type (e.g., numeric values
must be assigned
to
numeric variables, single-precision values to
single-precision variables, double-precision values
to
double-precision
variables, etc.)
Use a comma
(,)
, space (&H20),
CR
(&HOD),
LF
(&HOA),
or CR
+
LF
as a delimiter when data are read into numeric variables. Spaces
preceding data
are
ignored.
Use a comma (,),
CR,
LF, or
CR
+
LF
as
a delimiter
to
read data into
character variables. Spaces preceding data are ignored. If a double
quotation mark appears at the beginning of data, data
is
read up to the
next
double
quotation
mark.
A
comma
in
a
character
string
enclosed
by
double quotation marks is assumed not to be a delimiter.
156
EXAMPLE:
10:
A$
=
"AS"
+
CHR$ 34 + "CDEn
+
CHR$ 34
20:
S$
=
CHR$ 34
+
"CD,EF"
+
CHR$ 34
30: PRINT A$
40: PRINT B$
50: OPEN nE:ABC.DAT"
FOR
OUTPUT
AS
#2
60: PRINT #2,A$;",";B$
70: CLOSE
80: OPEN "E:ABC.DAT"
FOR
INPUT AS
#2
90: INPUT
#2,
C$,
D$
100: PRINT C$
110: PRINT
D$
120: CLOSE:END
Execution
RUN
I
EMlER
I
AS"CDE
"
"CD,EF"
AB"CDE"
CD
,
EF
157