Chapter 9

Text Files

Most of the programs that you use on a regular basis would be far less useful if they did not have the ability to read from and write to files. Consider a word processor that could not save your files and let you load them back in later: One where you had to print the paper before you closed the program to have any record of what you had done. Such a program would not be very useful and as such, it would not be used much. That is true even if it provided you with a very full set of other capabilities.

The reason for this is that all work you do without a file sits in the temporary memory of the computer that is given to the application when it runs. When the application is stopped, for any reason, all of that memory is lost. ...

Get Introduction to the Art of Programming Using Scala now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.