OPEN filename$ FOR output AS #1
INPUT "How many ____?", N
FOR I = 1 to N
INPUT "How many___?", NO
INPUT "what name?", N$
WRITE #1, NO, N$
NEXT I
CLOSE #1
Back
print one at a time
Front
OPEN filename$ FOR input AS #1
WHILE NOT EOF(1)
INPUT #1, NO, N$
CLS
PRINT "Amount:"; NO
PRINT "Name:"; N$
CALL ANYKEY
WEND
CLOSE #1
Back
input
Front
reads from a file. FROM FILE
Back
3 modes
Front
output, input, append
Back
EOF
Front
end of file. means that this is where the file has ended
Back
basic program ends in
Front
.BAS
Back
text files
Front
collections of values stored permanently in a file
Back
text files vs arrays
Front
text file is permanent on disk. Arrays are temporary in memory
Back
have to have it at end to stop access to a file
Front
CLOSE #1 (for channel #1) or CLOSE #3 (for channel #3), etc
Back
open command
Front
OPEN filename FOR mode AS channel #1
Back
append
Front
adds on to a file
Back
WRITE #1
Front
puts values INTO the file and ADDS COMMAS (writing to the file)
Back
add on
Front
OPEN filename$ for APPEND as #1
INPUT "How many would you like to add?", N
FOR I = 1 to N
INPUT "How many___?", NO
INPUT "what name?", N$
WRITE #1, NO, N$
NEXT I
CLOSE #1
Back
text files end in
Front
.TXT or .DAT
Back
PRINT
Front
same as write BUT HAS NO COMMAS
Back
output
Front
writes to a file (create new. if it already has something. it will all be erased). TO FILE