Page 285 - Learn to Program - Basic-256
P. 285
Chapter 18: Files – Storing Information For Later. Page 269
Read() Function and Write Statement:
In the first three programs of this chapter we have discussed the readline()
function and writeline statement. There are two other statements that will
read and write a file. They are the read() function and write statement.
read
read()
read(filenumber)
Read the next word or number (token) from a file. Tokens are
delimited by spaces, tab characters, or end of lines. Multiple
delimiters between tokens will be treated as one.
If filenumber is not specified then file number zero (0) will be
used.
write expression
write (expression)
write filenumber,expression
write (filenumber,expression)
Write the string expression to a file file. Do not add an end of line
or a delimiter.
If filenumber is not specified then file number zero (0) will be
used.
© 2019 James M. Reneau (CC BY-NC-SA 3.0 US)

