Files

File
Computer programs store data that will be required again in a file.
Every file is identified by its filename.
Text files contain a sequence of characters.
Text files can include an end of line character that enables the file to be read from and written to as lines of characters.
OPENFILE <file identifier> FOR <file mode>
READFILE <file identifier>, <variable>
WRITEFILE <file identifier>, <variable>
EOF(<file identifier>)
CLOSEFILE <file identifier>DECLARE textLn : STRING
DECLARE myFile : STRING
myFile ← "myText.txt"
OPENFILE myFile FOR WRITE
REPEAT
OUTPUT "Please enter a line of text"
INPUT textLn
IF textLn <> "" THEN
WRITEFILE myFile , textLn
ELSE
CLOSEFILE myFile
ENDIF
UNTIL textLn = ""
OUTPUT "The file contains these lines of text:"
OPENFILE myFile FOR READ
REPEAT
READFILE myFile, textLn
OUTPUT textLn
UNTIL EOF(myFile)
CLOSEFILE myFileFile
单选题
ID:199Which one is wrong for file operation?
[0/1]